I’ve always found the easiest way to script the volume of an OS X computer (and when I say volume I mean sound level, not a logical volume created from partitioning a hard drive – but I have articles for scripting those as well) is using the osascript command to invoke an Applescript command that sets the volume to zero. To put some syntax around this: osascript -e "set volume 0"
-
-
Disable the What’s New/First Run Prompts in Office 2016
Office 2016 shuffled a few minor things around, as it usually does. And while preparing our users to enjoy their Office 2016 experience, admins would like to suppress those dialogs. To do so, we’ll need to write the kSubUIAppCompletedFirstRunSetup1507 key as boolean and true into each of the /Library/Preferences files for Office in OS X (e.g. com.microsoft.Word.plist). Here’s a quick scriptable that will take care of that for ya’: defaults write /Library/Preferences/com.microsoft.Word kSubUIAppCompletedFirstRunSetup1507 -bool true defaults write /Library/Preferences/com.microsoft.Outlook kSubUIAppCompletedFirstRunSetup1507 -bool true defaults write /Library/Preferences/com.microsoft.PowerPoint kSubUIAppCompletedFirstRunSetup1507 -bool true defaults write /Library/Preferences/com.microsoft.Excel kSubUIAppCompletedFirstRunSetup1507 -bool true defaults write /Library/Preferences/com.microsoft.Word kSubUIAppCompletedFirstRunSetup1507 -bool true Update on October 29, 2015: A user may have already received…
-
Find or Kill A Signal By Name In OS X
You can query whether a process is running by name. You can do this with ps and pipe the output to grep. It’s not hard, but you can do this more quickly with pgrep. You can also kill that process with pkill. Which includes the ability to send a signal. So, let’s look at closing down iTunes with pkill: pkill iTunes Or we can send it with a signal (9): pkill -9 iTunes Or you could just grab the pid of a process by name: pgrep Safari It might display: 797 And that’s it. Easy Peasy.
-
Hide Safari’s Bookmarks Bar
Safari has a bookmarks bar. Some people want to hide it. A lot of people used to do stuff like this by modifying the default user template in OS X. Not something we’ll be doing much in the future. So to do so with a script: defaults write com.apple.Safari ShowFavoritesBar -bool false To turn it back on: defaults write com.apple.Safari ShowFavoritesBar -bool true
-
Disable Unicast ARP Cache Validation In OS X
As of OS X 10.9 (and in many cases more importantly in OS X Server for 10.9 and higher), OS X now performs ARP cache validation when trying to pass traffic over a router. If you are double NAT’d/use redundant gateways then the traffic can be interpreted as network redirection and cause some pretty bad packet loss/latency. You can disable this feature by turning off net.link.ether.net.arp_unicast_lim using sysctl: sysctl -w net.link.ether.inet.arp_unicast_lim=0 That will only disable unicast arp validation until the next reboot. If it fixes a latency problem you’re having then you can go ahead and make it permanent by adding the following line into /etc/sysctl.conf: net.link.ether.inet.arp_unicast_lim=0 If you’re still…
-
Some minor updates to https://krypted.com/
So a few months ago, closing in on 3,000 posts, the database got too big and krypted.com started suffering from innodb corruption, resulting in database outages. While I was able to get the site up, it was using a read-only database that kept me from doing any new articles or updates. It was a strange time in my life, like suddenly being single after living with someone since Y2K (when I started the site). But I got through it and was able to repair the relation… er, site. Now, with a new database that is free from corruption we’re ready to get to 6,000 posts! Also, I had a little…
-
Command Line Firewall Management In OS X 10.10
The tools to automate OS X firewall events from the command line are still stored in /usr/libexec/ApplicationFirewall. And you will still use socketfilterfw there for much of the heavy lifting. However, now there are much more helpful and functional options in socketfilterfw that will allow you to more easily script the firewall. Some tricks I’ve picked up with the Mac Firewall/alf scripting: Configure the firewall fully before turning it on (especially if you’re doing so through something like Casper, FileWave, Munki, or Absolute Manage where you might kick yourself out of your session otherwise). Whatever you do, you can always reset things back to defaults by removing the com.apple.alf.plist file…
-
Don’t Use bless To Change Startup Disks Any More In OS X
For a long time, we used the bless command to startup systems to a specific volume in OS X. Back in 2009 I started using the systemsetup command for more and more tasks. These days, I’m being guided to replace all of my bless options in scripts to systemsetup. The easy way to configure your startup volumes using systemsetup is to list the available volumes, set one as the startup volume and then check to see which one is the current volume. The first task is to list the available startup volumes, using the -liststartupdisks option: sudo systemsetup -liststartupdisks You can then set the disk as one that was listed…
-
Using odutil with opendirectoryd
The options for Open Directory continue to get more refined, aligning with opendirectoryd. The odutil command is becoming more and more useful with each version of OS X. Let’s inspect the directory service cache, using odutil with the show verb and the cache option: odutil show cache You can also view statistics for opendirectoryd using that show verb but with the statistics option: odutil show statistics And to see everything, use odutil with the show verb and the all option to get plenty of data to grep through: odutil show all The final show option we’ll look at is configuration. Here, you will also need to feed a directory nodename…
-
Edit NetBoot Sets Without Creating New Images
Mac admins spend a lot of time building images. In System Image Utility this can mean baking an image that just looks for a path of a NetRestore source and restores an operating system. Constantly making these is a pretty duplicative task. The goal of this article is to take a generic NetRestore NetBoot image and augment it in such a way that you don’t need to create new NetBoot images unless there’s a new build train. Instead, all you need to do is edit a file that changes the path (uri) of your image so that it can be restored. Using this, you can just stop the NetInstall service in…