Difference between revisions of "Mac tricks"
From dbawiki
(→Set the volume from the command line) |
|||
| Line 63: | Line 63: | ||
<pre> | <pre> | ||
defaults write com.apple.finder AppleShowAllFiles -boolean true; killall Finder | defaults write com.apple.finder AppleShowAllFiles -boolean true; killall Finder | ||
| + | </pre> | ||
| + | ===Automatically start Apache Web Server at boot time=== | ||
| + | <pre> | ||
| + | sudo defaults write /System/Library/LaunchDaemons/org.apache.httpd Disabled -bool false | ||
</pre> | </pre> | ||
Revision as of 18:17, 9 October 2016
Contents
- 1 When your Mac won't start
- 2 Set the volume from the command line
- 3 Print from the command line
- 4 To clean up the right-click context menu
- 5 Some Terminal tricks
- 6 List known disks
- 7 Create a bootable OSX Mavericks on a USB stick / thumb drive
- 8 Show (or set) Power Management Settings
- 9 Turn Sudden Motion Sensor off
- 10 Show hidden files
- 11 Automatically start Apache Web Server at boot time
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
osascript -e "set Volume 5"
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).
lp -d <queuename> <file>
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
Some Terminal tricks
macs.about.com/od/usingyourmac/tp/terminaltricks.htm
List known disks
diskutil list
Create a bootable OSX 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...
sudo /Applications/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia --volume /Volumes/Untitled --applicationpath /Applications/Install\ OS\ X\ Mavericks.app --nointeraction
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.
It all goes well, be prepared to make a cup of tea and take your time drinking it...
Password: Erasing Disk: 0%... 10%... 20%... 30%...100%... Copying installer files to disk... Copy complete. Making disk bootable... Copying boot files... Copy complete. Done.
or
Show (or set) Power Management Settings
sudo pmset -g
Turn Sudden Motion Sensor off
sudo pmset -a sms 0
defaults write com.apple.Finder AppleShowAllFiles TRUE;\killall Finder;\say Files Revealed
and on Mavericks
defaults write com.apple.finder AppleShowAllFiles -boolean true; killall Finder
Automatically start Apache Web Server at boot time
sudo defaults write /System/Library/LaunchDaemons/org.apache.httpd Disabled -bool false