Reset Lost password
First up, you need to reboot your computer while holding the Command and the R keys down. Hold your Mac’s power button down for about six seconds, and it will turn off. Wait a couple of seconds more, and then hold down Command-R on your keyboard while pressing the power button again to turn the machine on. Keep holding the Command-R combination until you see the little spinning circle just below the Apple logo on the boot up screen.
Once your Mac boots, you’ll see a window with various options. Use your mouse to select Terminal from the Utilities menu, and Terminal will launch. Type in
and you’ll get a dialog box that will let you do just that. Choose the user you want to change the password for, and type in the new password twice. Hit OK, close the reset password window, and reboot your Mac.
Show Hidden Files in finder
defaults write com.apple.finder AppleShowAllFiles TRUE
To set it back (that .DS_Store on the Desktop is hella irritating), execute those same commands, but just switch that TRUE to FALSE
Useful OX 10 Shortcuts
|Open the Force Quit window
|Cycle through active applications in the Dock
|Open Mac Help
|Go back in the finder view to the previous item
|Go to folder
|Hide Finders toolbar
|Duplicate; creates a duplicate copy of a selected items.
|Turn Dock hiding on/off
|Move item to trash
|Eject the selected disk image, CD, etc.
|Show view options in the Finder.
|Connect to Server
|Minimize all open windows for an application
|Open a new Finder window
|Create a new folder
|Open file or folder
|Add to Favorites
|Close all windows
|Go to Applications view in the Finder
|Go to Computer view in the Finder
|Go to Favorites view in the Finder
|Go to Home view in the Finder
|Go to iDisk view in Finder
|Take a screenshot of the entire display
|Make and capture a rectangular selection of the display
Mac Terminal Commands only
ls -lah | pbcopy
will copy the output to the clipboard
will speak hello
say -f filetoread.txt
will read contents of text file
say -f filetoread.txt -o audiofile.aiff
will output to an audio file
defaults write com.apple.finder AppleShowAllFiles -bool TRUE
Show . files in finder
defaults write com.apple.finder _FXShowPosixPathInTitle -bool TRUE
Display Unix path in Finder Windows
defaults write com.apple.screencapture type PNG
Modify Screen caputre type formats are PNG, BMP, GIF, JPED, PICT, PSD, SGI, TGA, TIFF
defaults write com.apple.screencaputre location "Users/robert/Desktop"
Modify screen capture location
Grep: searching with regular expressions
Grep Options (exmple: grep -Rl filename // will return filenames only
-i Case insensitive
-w Whole words
-v lines that don't match
-c return count
-n add line nunbers with search
-R search Directories Recursively
-Rl return only filenames
-RL Filename that do not match
ps aux | grep Applications // will return all running applicatiosn
Use Single User Mode to Solve Issues
Shutdown the Mac, wait 15 seconds
Hold down the Command and S Key While pressing the power button to start the mac.
At the Terminal prompt type,
//filessytem check -y means asnswer yes to any questions f means force
type reboot when finished
Apache, PHP, MySql setup on Mac
Check Apache Version: httpd -v
Check php Version: php -v
sudo apachectl start
sudo apachectl stop
sudo apachectl restart
Change directory where apache serves from
create a conf file, name it the log on user name
Options Indexes MultiViews
Allow from all
change permissions : sudo chmod 644 filename.conf
sudo apachectl restart
Upgrade Php to latest version
Edit PHP.ini to fix time zone; you have to modify two places
dmg, 64 bit version
Add the mysql dir to your path
nano .bashrc ; add line below
set mysql password
mysqladmin -u root password
To change the password
mysqladmin -u root -p password
Restarting Apache in OSX
Open Terminal, you have to have root access
type command; apachectl restart
Turning on Root access in OSX
Go to the Terminal:
sudo passwd root
and follow instructions
Mac OX 10 Directory Structure
File or Folder Description
/.DS_Store - Contains Finder settings for the current directory. This folder is generated for any directory viewed in Finder.
/.Spotlight‐V100 - Contains Spotlight‐specific metadata
/.Trashes - Contains files that have been dragged to the Trash
/.com.apple.timemachine.supported - Indicates that a drive can be used by Time Machine as a backup target
/.fseventsd - Used by the FSEvents API
/.hotfiles.btree - A B‐Tree index that provides fast access to frequently used files
/Applications - Holds all Mac OS X applications
/bin - Contains essential system binaries
/Desktop DB - Contains housekeeping information used by Finder
/Desktop DF - See /Desktop DB
/dev - Contains device‐specific files
/Developer - Contains Apple's XCode tools and documentation (but only if you've installed them)
/etc - Contains system configuration files. This is a symbolic link to /private/etc.
/home - Used by the automounter for NFS‐mounted home directories
/Installer Log File - Used by some third‐party installers
/Library - Contains support files for locally installed applications
/lost+found - Stores orphaned files discovered by fsck
/mach_kernel - Contains the Darwin kernel
/mach_kernel.ctfsys - Contains an alternate copy of the kernel (used by dtrace)
/net - Used by the automounter for NFS‐mounted directories
/Network - Contains network‐mounted Application, Library, and User folders
/opt - Contains the MacPorts installation (if installed)
/private - Contains the tmp, var, etc, and cores directories
/sbin - Contains executables for system administration and configuration
/sw - Contains the Fink installation (if installed)
/System - Contains various folders, the most important of which is Library, which holds support files for the system and system applications
/tmp - Holds temporary files. A symbolic link to /private/tmp.
/User Guides and Information - An alias to /Library/Documentation User Guides and Information
/Users - Contains home directories for users on the system (root user's home is /var/root)
/usr - Contains BSD UNIX applications and support files
/var - Contains frequently modified files, such as log files. Symbolic link to /private/var.
/Volumes - Contains all visible mounted file systems, including removable media and mounted disk images
Finding Php.ini File in OsX
The Php.ini is not necessary in OSX but if it exists it would be in the /Private/etc dir
Well Known Mac OS X Ports
TCP Port Numbers Commonly Used by Macintosh Services
UDP Port Numbers Commonly Used by Macintosh Services
Locked Files in MacOSX
When a file is "locked" by OS X, it is applying what *nix calls a "flag" to the file. In this case, the flag is "uchg", which means that no user, even root, can alter the file in any way until the flag is removed. You can use the command chflags to remove the flag.
The following example should unlock every file in your home directory:
sudo chflags -R nouchg ~/
Here's a breakdown of the command:
sudo will run the chflags command as root (you may be prompted for your root password).
-R will cause the command to affect every file in the directory and all of its subdirectories. Yes, capitalization matters.
nouchg is the syntax for removing the uchg flag. Any flag can be removed by putting "no" in front of it.
You can of course substitute the tilde (~) with whatever directory path you want to affect. To change an individual file, leave out the -R and type the file path instead of a directory path. Normal operators apply, such as $ and *.
Apache2 - Mac osx
Apache cofig file is found in the private/etc/apache2
it is a hidden directory under the root. you can access it by Clikcing "Go" under the menu and then click "go to folder" Then type in the directory..
you have to change the ownership of the file in order to modify it. I had to login as an ftp user to changer the file.