Thursday, October 16, 2014

Yosemite SUCatalog Size

When I noticed repo_sync downloading all the OS X voices again I got mildly concerned about storage space.

Luckily, I learned that lesson once already and /var is mounted on top of an LVM storage pool in the Ubuntu VM that runs reposado. After a quick 'df -h' I switched over to ##osx-server and asked about the yoyo's storage requirements. gneagle suggested I do some investigation on my own and publish what I discovered.

I decided to stop the repo_sync run for the time being and disable the cronjob.

Later, I got curious and whipped this up in an iPython notebook after briefly taking a look at the catalog itself.


import plistlib
import urllib2

catalog_url = ''
total_size = 0.0

yoyo_sucatalog = urllib2.urlopen(catalog_url).read()
yoyo_plist = plistlib.readPlistFromString(yoyo_sucatalog)
yoyo_prod = yoyo_plist['Products']

for k in yoyo_prod:
    for item in yoyo_prod[k]['Packages']:
        total_size += item['Size']

print str(total_size / 1073741824) + ' GiB'
print str(total_size / 1000000000) + ' GB'

And the output?

128.361939469 GiB
137.827583018 GB

So there you have it. Approximately 130-140 Gigs (for varying definitions of Gig).

There is probably some insignificant amount of overhead in everything that comes down from the server too. *shrug*

Looks like I need to add a drive to the VM and expand the pool. :)

Thursday, October 9, 2014

munki is so damn cool

This post only exists because twitter's character count is too small…

but FYI munki is so damn cool.

The following items will be installed or upgraded:
        + duti-1.5.2
            set default applications for doc types
        + duti_launchagent-1.0
            runs duti at login on dir /Library/Glenbrook225/duti
        + AcrobatXProCS6-10.1.1
        + AcrobatUpd-10.1.10
        + duti_acrobatpro-1.1
            sets Acrobat Pro as editor for pdf at login via duti and duti launchagent

Only one of those things was actually in the manifest.


Thursday, April 24, 2014

pkgbuild many MAS apps with bash

I wanted to quickly create pkgs for iWork and iLife from apps with an institutional ID receipt because I am experimenting with AutoDMG and Lightning.

It takes a bit of time for some of these to build and I didn't want to wait around so here is what I did…

Start an array by just typing array=( into the command line and then hitting <return>
admin_dist@golden ~ $ array=( 
Drag and drop the apps into the Terminal window hitting <return> after each
> /Applications/ 
> /Applications/ 
> /Applications/ 
> /Applications/ 
> /Applications/ 
> /Applications/
When they are all in finish off the array
> ) 
Now for the good stuff.  :D

For each path in the array
admin_dist@golden ~ $ for path in "${array[@]}"; do
 greedily chomp from the front to the last / using parameter expansion
> app_name="${path##*/}"
chomp from the end to the first period
> name="${app_name%.*}"
get the version of the thing at $path using command substitution and an assignment
> version=$(defaults read "${path}"/Contents/Info CFBundleShortVersionString)
build it with a pretty name
> pkgbuild --component "${path}" $HOME/Desktop/"${name}-${version}".pkg
> done

This will give you nice installer packages on the Desktop of the form "GarageBand-10.0.2.pkg".

Here is gist with a full script instead of interactive command line entries.

Thursday, April 17, 2014

Quick Tip - updatejournal.plist

I just migrated from an old 13" MacBook Pro to a new 13" Air.

I quickly found out that Migration Assistant in Mavericks over Thunderbolt is mostly broken.

Not a problem for me, I know how to use rsync with --exclude!

After getting my user directories moved over I found something rather annoying. MAS still showed that I had installed a bunch of updates, particularly developer seeds, that I most certainly was not running on this new machine.

I poked around for a few minutes with pkgutil, ls'd a bunch of folders, poked & prodded until finally throwing my hands up in exasperation.

Where the heck is this coming from!?!

I methodically started going through my User-level Library (as I now knew the updates only showed up for my standard user and not the admin) and found the offender.


After banishing this annoying little bugger to to the Trash my update list is free and clear.

Wednesday, March 19, 2014

Install bash 4.2.45 in 3 minutes or less

So here we go.

I set PS1 to '\t \$ ' in order to document the time required to do this. Everything was typed by hand and done from memory except a short alt-tab to nvALT to ensure proper numbering for curl'ing the patches.

  • md src
  • curl -OL
  • tar xzf bash-4.2.tar.gz
  • cd bash-4.2
  • md patches
  • curl -L "[01-45]" -o "bash42-0#1"

step 1 - 6
  • cd ..
  • for patchfile in ./patches/*; do patch -p0 <"$patchfile"; done

step 7-8
  • ./configure
  • make -j4
  • sudo make install

To wrap up simply edit /etc/shells like in my previous post and chsh -s on your user.

Friday, March 7, 2014

bash 4.3 install

I had intended this to be a post about how to quickly & easily install bash 4.2.45 but then I saw that 4.3 came out about two weeks ago.

Why would you want bash 4.x?

Welp. Bash 3.2.51 came out in March of 2010 and yet that is still the included version in Mavericks. Why else might you want bash 4? Here are a few of my favorites:
  1. globstar
  2. Zero padded brace expansion
  3. case changes via Parameter expansion
  4. Associative Arrays
Want to install bash 4.3? Here is a super fast way to do it:

md ~/src
curl -OL
tar xzf bash-4.3.tar.gz
cd bash-4.3
make -j4
sudo make install

Now the next thing we want to do is set it as our login shell so that we can use all these fun options by default. To do this we will use the chsh command but will probably run into an error.

$ chsh -s /usr/local/bin/bash
Changing shell for ryan.
Password for ryan:
chsh: /usr/local/bin/bash: non-standard shell

To see why this happens take a look at man shells. At this point I just want to fix it. Edit /etc/shells in your editor of choice and add /usr/local/bin/bash to the list of allowed shells, then run chsh again.
Sweet sweet victory!

EDIT: You might be leery of running two week old software as your login shell, next post I will show you how to install fully patched bash 4.2.45 from source in 3 minutes and 9 seconds! #whyyoudontneedbrew

Monday, February 24, 2014


So...I kind of lied in my first post. It was a little white lie. I didn't actually do a mkdir and then a cd.

In my configuration files for bash I have a function defined that can do this for me.

$ type md
md is a function
md ()
    /bin/mkdir -p "$1" && builtin cd "$1"

Breaking this down is pretty easy.

Use the mkdir command with the -p option for two reasons:
  1. intermediate directories will be created if I specify a long path
  2. errors will not pollute the terminal in almost all cases
$1 is a positional parameter specifying an item passed after calling the script or function. In this case it will be the directory I want to create and change into.

&& is a control operator that ensures that the cd will only execute if the mkdir exited successfully.

Specifying the builtin cd is only really necessary because I have made a function for my own cd which I might cover in another post sometime. It also has the side benefit of ensuring we use the builtin instead of /usr/bin/cd which will be quite a bit faster.

So what does all this mean? I can do the following at the command line instead of the two separate commands at beginning of my first post.

$ md src
$ pwd

Blog Refinement

I took a look at this last night and I realized two things:

The title looked dumb on my iPhone so I am expanding Mac to Macintosh. :)

I need to make another post about mkdir.

Friday, February 21, 2014

Compiling MTR on Mavericks

MTR is a really cool tool for viewing where in a series of network hops you might be having problems. Here is how you can get it on OS X.

mkdir ~/src
cd ~/src

curl -OL
tar xf autoconf-latest.tar.gz
cd autoconf-2.69
./configure --prefix=/usr/local

NOTE: you may get a pop-up at this point asking you to 'Get Xcode' or 'Install'. Clicking the Install button will download from Apple the software you need to compile source from the command line without waiting for all of Xcode. Once the installation is complete run configure again.
sudo make install
cd ..

curl -OL
tar xf automake-1.14.1.tar.xz
cd automake-1.14.1
./configure --prefix=/usr/local
sudo make install
cd ..

git clone
cd mtr
./configure --without-gtk
sudo make install

EDIT 2014-04-29: removed z from tar options. Fixed directory name for automake. Added note for Xcode pop-up.