Monday, September 21, 2015

Fix Frozen App Store Updates and High softwareupdated CPU in OSX

We all know the familiar Mac OS X Software Update and App Store Updates panel, it pops up weekly to give us a nice GUI interface to install all the latest updates to our Apple software. But did you know that you can get the same list, query the available updates list, and even install updates from the command line? 
Installing software updates from the command line is incredibly useful for remote management of machines, just SSH into a Mac and run the appropriate commands. Read on for more…

To install software updates from the command line, you’ll use the aptly named ‘softwareupdate’ command. Here are the most relevant usages of the command for most users:
 
softwareupdate -l
will give you a list of all updates available
softwareupdate -i [package name]
will install the specified package
softwareupdate -i -a
will install all updates available
softwareupdate -i -r
will install only the recommended updates
softwareupdate --ignore [package name]
will ignore specified update
softwareupdate --help
for more info on the softwareupdate command
You’ll likely need to use the sudo command to actually install the updates on a Mac, simply place sudo in front of one of the above commands to run it with full permissions as root. 
For example: 
sudo softwareupdate -i -r

Display Your Download HIstory on a Mac OSX with a Terminal Command

Your Mac logs pretty much everything you download, and if you've lost a file, or you just want to see how much you've downloaded, iDownloadBlog shares a simple Terminal command that reveals everything you've put into your Downloads folder. 
Chances are you download a lot of things over you Mac's life, and if you want to find an old file you've since deleted, or you're just curious to see how much you downloaded, all it takes is a Terminal (Applications > Utilities) command:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'select LSQuarantineDataURLString from LSQuarantineEvent'
One you load that up, Terminal should give you a (potentially very large) list of everything you've downloaded. If that makes you a little uncomfortable, you can easily delete everything in the database as well by typing this into Terminal:
sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'
Once that command is run, your download history should disappear forever.

Sunday, September 20, 2015

Optimizing SSD Access-Time (noatime)

Terminal commands:

echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
 "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
 <dict>
 <key>Label</key>
 <string>com.noatime</string>
 <key>ProgramArguments</key>
 <array>
 <string>mount</string>
 <string>-vuwo</string>
 <string>noatime</string>
 <string>/</string>
 </array>
 <key>RunAtLoad</key>
 <true/>
 </dict>
</plist>' | sudo tee /Library/LaunchDaemons/com.noatime.plist
sudo chown root:wheel /Library/LaunchDaemons/com.noatime.plist

Reboot

Friday, September 11, 2015

Control Your OSX Power/Performance With pmset

When you are in terminal and you type “pmset -g” (without quotes) you will see something like this
 
#pmset -g
Active Profiles:
Battery Power        -1
AC Power        -1*
Currently in use:
 standbydelay         4200
 standby              1
 womp                 0
 halfdim              1
 hibernatefile        /var/vm/sleepimage
 darkwakes            0
 gpuswitch            1
 networkoversleep     0
 disksleep            0
 sleep                60
 autopoweroffdelay    14400
 hibernatemode        0
 autopoweroff         1
 ttyskeepawake        1
 displaysleep         10
 acwake               0
 lidwake              1

womp: wake on ethernet magic packet, 1 to enable or 0 to disable
autorestart: automatic restart on power loss, 1 to enable or 0 to disable
halfdim: display sleep will use an intermediate half-brightness state between full brightness and fully off, 1 to enable or 0 to disable
sms: use Sudden Motion Sensor to park disk heads on sudden changes in G force, 1 to enable or 0 to disable
hibernatefile: change hibernation image file location. Image may only be located on the root volume.
gpuswitch: which GPU you are using (0 for integrated GPU, 1 for dedicate gpu)
disksleep: disk spindown timer (value in minutes, or 0 to disable)
sleep: system sleep timer (value in minutes, or 0 to disable)
hibernatemode: change hibernation mode. Please use caution. (value = integer)
ttyskeeepawake: prevent idle system sleep when any tty (e.g. remote login session) is ‘active’. A tty is ‘inactive’ only when its idle time exceeds the system sleep timer. (value = 0/1)
displaysleep: display sleep timer (value in minutes, or 0 to disable)
acwake: wake the machine when power source (AC/battery) is changed, 1 to enable or 0 to disable
lidwake: wake the machine when the laptop lid (or clamshell) is opened, 1 to enable or 0 to disable

For the new Macs, the most important ones are ( hibernatemode and gpuswitch). If your Mac come with SSD, then disksleep is also important. Make sure you set them as they appear above for the best performance.