This is an old revision of the document!
Table of Contents
Mac_tricks
When your Mac won't start
Startup in single user mode and fsck Briefly:
- hold down Command-S for single-user mode. (Hold down Command-V for verbose mode)
- /sbin/fsck -fy
- reboot
Set the volume from the command line
0@@
Reset admin password using recovery mode
Forgot the password? Locked out of your Mac?
- Reboot your Mac while holding down the Command key and R. Keep holding the key combination until the loading bar appears.
- Once in the Recovery Mode, select Terminal from the Utilities menu.
- Type “resetpassword” in the Terminal window and hit enter.
- Select the storage device that contains the operating system.
- Select the admin account.
- Click on the Change Password button.
- Enter a new password as well as a new password hint.
- Save and restart from the main menu.
- Log in with your new admin password.
Reset admin password using single-user mode
- Access the single-user mode by holding the Command key and S on startup.
1@@
- Log in with your new password.
Print from the command line
Look at the advanced properties of the printer in System Preferences for the queue name (it will be the same as the printer name with all spaces and dashes replaced by underscores).
2@@
To clean up the right-click context menu
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
Enable user's personal web site
From Mountain Lion onwards Sharing control panel no longer contains “Web sharing” to turn on web servers so command line comes to the rescue…
3@@
To have the Apache server start at each boot, follow above with this…
4@@
Some Terminal tricks
List all network hardware ports
5@@
6@@
Find out which dhcp server assigned the IP address
DHCP server is the line marked as <tt>server_identifier</tt>
7@@
8@@
Renew DHCP lease on MacOS
9@@
List known disks
10@@
Create a bootable OSX / MacOS Mavericks on a USB stick / thumb drive
This way worked for me…
- Download the Installer from the App Store. You end up with a file called “Install OS X Mavericks.app” (5.34Gb) in your Applications folder (and the Install OSX application open)
- Format a USB drive. Use Disk Utility. Partition tab, 1 partition, options… GUID. Call it “Untitled”. Here's the bit… Check the mount point at the bottom of the screen! (Does it say /Volumes/Untitled?)
- Don't eject / unmount it.
- Open Terminal. Run the following command…<br />
11@@
If the mount point was /Volumes/Untitled then this command will work. If it was anything else, you will get an error. Change the name of the “–volume” attribute to what you saw as the mount point.<br /> If all goes well, be prepared to make a cup of tea and take your time drinking it…
12@@
or
Show (or set) Power Management Settings
13@@
Turn Sudden Motion Sensor off
14@@
Show hidden files
15@@
and on Mavericks
16@@
Automatically start Apache Web Server at boot time
17@@
