Restoring a Mac partition to its full size

Usually, when you add a new partition to a Mac using Disk Utility, you can then just (minus sign) delete the new partition and Disk Utility will automatically expand your first partition to take up the free space.

Occasionally, Macs will act weird and not fill up the free space and, more importantly, not let you manually drag the old partition to fill up the free space. You're just stuck with unusable free space.

There is a relatively simple solution that involves only a couple of terminal commands. (Thanks to the Restore Macintosh HD to its original partition configuration thread on Stack Exchange for the tip.)

Boot up into recovery mode (Cmd-R at startup). If you want to be extra safe, use Disk Utility to back up your first partition in case something goes wrong.

Go to Utilities > Terminal.

Enter in this command:

diskutil cs list
and get the Logical Volume UUID of your partition-to-expand.

Then run

diskutil cs resizeStack XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX 0g
where XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX is the UUID in question.

expandpartition01
You should see the progress of your partition expanding.

expandpartition02
Then you'll see it verifying the volume.

That's it. Your partition should now be fully expanded.

Packaging FileMaker Pro for Munki

If your organization, school, or company has volume licensing for FileMaker Pro and want to make your package Munki-able, this is how you do it (based on Assisted install for FileMaker Pro and FileMaker Pro Advanced).

munkifilemaker01
Older: Find your FileMaker installer .mpkg file. This installer file will likely come on a read-only medium (read-only .dmg or actual physical CD/DVD), so drag it to a temporary read/write location (e.g., your desktop).

Newer: In newer versions, the .dmg will have the Assisted Install.txt right in there next to the .pkg, and there is no .mkpg. If you are copying to a working folder (e.g., on your desktop), be sure you're copying all the invisible files as well.

munkifilemaker02
Older: Once that's copied over, right-click it and select Show Package Contents.

munkifilemaker03
Both Older and Newer: You should see a small text file called Assisted Install.txt. Open that to edit it.

munkifilemaker04
Both Older and Newer: Add in or change an options as you see fit (you don't need quotation marks around anything—just put the text for AI_USERNAME, AI_ORGANIZATION, and AI_LICENSEKEY after the equal sign on each line). For other options, 0 means No and 1 means Yes.

Make sure you change AI_LICENSE_ACCEPTED and AI_SKIPDIALOG to be 1 instead of 0.

When you're done, close and save the file.

Older: Next, just go ahead and import that modified .mpkg file into Munki (e.g., munkiimport FileMaker Pro ## Advanced.mpkg). The Munki import process will create a read-only .dmg container for the .mpkg file.

Newer: For newer versions, there is no .mpkg, so you'll have to create a disk image of the working folder you created earlier (e.g., ~/Desktop/FileMaker). Be sure to make it an HFS+ disk image and not an APFS one.

hdiutil create FileMakerPro17.dmg -volname "FileMaker Pro 17" -srcfolder ~/Desktop/FileMaker -fs HFS+

You can then munkiimport the resulting .dmg.

Make an installs array (/usr/local/munki/makepkginfo -f) based off the installed FileMaker so Munki doesn't get into an install loop, and then paste that installs array in the pkginfo for FileMaker and run makecatalogs afterwards.

Still waiting for root device on an iMac

I've had fairly good luck cloning Macs using Disk Utility and a Thunderbolt cable. Recently I ran into one stubborn one that wouldn't boot up properly after the re-image.

It went straight to a flashing Do Not Enter symbol. That was a bit confusing. Was there a physical connection problem with the drive? I could boot into recovery mode (Cmd-R), and that was fine—and in recovery mode I could see the newly-imaged partition. Rebooted again. Same deal with the Do Not Enter symbol. Maybe it was just a bad image.

Imaged from another machine. Same deal. Let me boot into verbose mode (Cmd-V) to see what's going on.
mp_still_waiting_for_root_device
I got Still waiting for root device repeated. Same deal if I tried to boot into single-user mode (Cmd-S).

When I Googled "still waiting for root device," all the top results had to do with Hackintoshes and not native iMacs. even if I Googled "still waiting for root device imac," all the top results have to do with Hackintoshes. Not very helpful, since this is a genuine Apple computer I'm working with.

Just on a lark. I held down the Option key at boot-up to see what drives were available. This actually got me somewhere, because I saw two options—Macintosh HD and the name of the partition I had just imaged. Now usually (and this is how it appears in Disk Utility in recovery mode) there is a larger disk called Macintosh HD with a partition underneath it. When that's the case, holding down the Option key at boot-up will show you only the bootable partition underneath.

When I tried to boot to Macintosh HD, I got the Do Not Enter sign again.

When I booted to the newly created partition, it booted just fine, though.

I had to explicitly select it at boot, though, every time. So I knew something was funky with the filesystem.

So I thought maybe I could just change the Startup Disk to use the working partition. When I tried to do that I got an error message that said you can't change the startup disk to the selected disk building boot caches on boot helper partition failed. None of the Google searching on that phrase helped me fix the issue.

I tried a fresh reinstall of OS X through recovery mode, but that failed:
mp_fresh_install_failure

Then I tried to see if I could verify and repair the disk using Disk Utility: mp_boot_os_x_could_not_be_repaired
It said, after I tried to repair it that I had to repair it. Thanks.

So I tried repairing it using recovery mode. mp_disk_needs_repair
Same deal. And same deal using the iMac in target disk mode (T) and then running Disk Utility repair on it from another Mac.

No matter what I did—trying to repair the drive, or to delete and re-create partitions; the partition table was super messed up, for whatever reason.

Now, I don't know if this is the solution, but it ended up being a working solution, even though it took a really long time! What I ended up doing was—instead of using Disk Utility—straight up copying entire partitions off another iMac to get the partition table corrected.

So I put the troublesome iMac in target disk mode. Same deal for a working iMac. And then I had a third iMac I hooked each of those into using Thunderbolt cables.

In the terminal, I used

diskutil list
to get all of the actual disks/partitions in question. There were three listed for each. I started with the top and just went down—copying disk8 to disk5 and then disk7 to disk4. Here's an example:
sudo dd if=/dev/disk7 of=/dev/disk4 bs=128m conv=noerror,sync
Be very careful using the dd command. It can be very destructive if you don't know what you're doing. if is the input filesystem and of is the output filesystem. You won't see any visual feedback on the progress, but you can press Control-T (not Cmd-T) to see it from time to time.

Overall, across a Thunderbolt connection, it took about two full days (48 hours) to complete a 1 TB drive transfer... but it worked! (Your mileage may vary.)

P.S. Once it was done, I was able to boot into single-user mode, run an fsck to clean the filesystem, and then reboot into normal mode and verify the disk from Disk Utility with no errors.

Packaging Adobe Acrobat for Windows from Adobe CS6 Master Collection

It's fairly straightforward to make à la carte packages for Mac using AAMEE if you have a site license. I thought it'd be equally straightforward to do so for Windows as well. There is one exception—Adobe Acrobat Pro.

Every time I tried to install it based on the build, the installer would just die in the middle. After doing some digging online, I found the recommendation to put in some cryptic command to get it to install. That appeared to get it installed, but then the program wouldn't launch because it was missing Adobe Application Manager.

Turns out you have to bundle it with at least one other Creative Suite component in order for the installation to work. In other words, it can't be just Adobe Acrobat Pro. It has to be Adobe Acrobat and Adobe Photoshop (or Illustrator or InDesign). And then you'd have to uninstall the other component later, if you wanted to have only Adobe Acrobat Pro installed.

Very odd, especially since—with the same kind of site license—Mac packaging of Adobe Acrobat Pro by itself works just fine.

Changing the Energy Saver schedule via the command line on a Mac

You can find a far more comprehensive tutorial at Power Management & Scheduling via Command Line, but if you want to change just the basic options, a command like this should do it:

sudo pmset repeat shutdown MTWRFSU 22:00:00 wakeorpoweron MTWRFSU 6:00:00
That's the equivalent of going to System Preferences > Energy Saver > Schedule and setting the computer to shut down every day (Monday, Tuesday, Wednesday, thuRsday, Friday, Saturday, sUnday) at 10:00pm (22:00 is military time), and then to power back on all those same days at 6:00am.

You can adjust the options as suits your needs. More details (and more options) in the link above.

Windows Explorer and Disk Management reporting different partition sizes

I ran into an issue with a user running Windows on a Mac. Windows should have taken up the entire drive (which is 250 GB), but Windows Explorer was reporting about 90 GB.

windowspartitionwrongsize01
The really odd thing is that within Disk Management itself, it reported 90 GB on top (same as Windows Explorer) but then 250 GB on the bottom... and no empty space after the partition.

I found the solution here:
I Expanded the Disk in Disk Manager but It Doesn't Show in Windows Explorer

windowspartitionwrongsize02
Launched up cmd.exe as administrator and then ran

DISKPART
List Volume
select volume 0
extend filesystem
and then it was all good.

Troubleshooting Mac “printing – printer is in use” error

I haven't seen this a lot, but it's common enough that you can find it in a Google search. Here are some of the top results:

I recently came across this situation with an HP printer, and I thought resetting the printer system was a bit extreme (especially since the user who brought it up had about six or seven printers installed that would have to be reinstalled).

I tried removing the printer and re-adding it. Same problem.

I tried adding the printer to my computer (to see if it was a problem with just the user's configuration or if the printer itself was having issues). I got the same problem on my computer, too.

I went through the HP menus to print out the printer configuration page. It spit out a backed-up print job before printing the printer configuration page, but not all of the backed-up jobs came out, and the "printer is in use" error persisted for both me and the user I was trying to help.

I waited a bit and then saw a message on the printer to hit the checkmark button. I hit it again, and all the backed-up jobs came out and the error went away for both me and the user.

So I don't know if that will always be the solution, but I'd at least give that a try before resetting the printing system.

Permanently add a self-signed certificate to Chrome on a Mac

Here's a great tutorial on how to do so. The only thing I had to change was importing the certificate from Keychain Access instead of double-clicking the certificate. Otherwise, it works fine, and the screenshots are very helpful!

If you prefer the terminal, you can save yourself a few steps at the end by using this command to add the certificate to the system keychain:

sudo security add-trusted-cert -d -r trustRoot -k "/Library/Keychains/System.keychain" /PATH/TO/CERTIFICATEFILE/ACTUALCERTIFICATE.cer

Deleting keychains at user logout

Update: The easiest way to do this is actually to install Offset and then put a RemoveLastUserKeychains script into /usr/local/offset/logout-every (make sure it's owned by root:wheel and has 755 permissions).

Backstory

This is a sequel to Deleting Mac Keychains in an Active Directory Environment, which talked about a way to delete keychains at logout using the (Apple-deprecated but still functional in Yosemite) logout hook or using a Launch Daemon that deletes all keychains at boot time.

The obvious downsides to those two methods are one being deprecated (so possibly not supported in the release after Yosemite) and the other running only at boot time (which doesn't take into account a user changing a password twice before the machine has a chance to reboot).

With a little trial and error and immense help from this post on StackExchange by a user named Haravikk, I've pieced together the exact steps to delete the user keychains at logout using a Launch Agent.

Create the shell script

We're going to create (if it doesn't already exist yet), a custom directory for your organization:

sudo mkdir -p /Library/nameofyourorg

Then make the script (again, you can do this in your favorite graphical text editor, move it over to the directory, and then change ownership to root user and wheel group, but this is a fairly straightforward way to do it one fell swoop without having to change ownership later):

sudo nano /Library/nameofyourorg/LogoutCleanKeychains.sh

In the text editor, paste in:

#!/bin/sh
onLogout() {
# Add entry to a log file
echo "$(date) - Keychain deleted" >> ~/Library/Logs/NAMEOFYOURORG.log

# Delete the keychains for this user
rm -rf ~/Library/Keychains/*

exit
}

trap 'onLogout' SIGINT SIGHUP SIGTERM
while true; do
sleep 86400 &
wait $!
done

Then save (Control-X).

Make the script executable

sudo chmod +x /Library/nameofyourorg/LogoutCleanKeychains.sh

Create the Launch Agent

You're going to create a custom .plist file

sudo nano /Library/LaunchAgents/local.logoutcleankeychains.plist

In the text editor, put in:

<plist version="1.0">
<dict>
<key>Label</key>
<string>local.logoutcleankeychains.plist</string>
<key>ProgramArguments</key>
<array>
<string>/Library/nameofyourorg/LogoutCleanKeychains.sh</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>EnableGlobbing</key>
<true/>
</dict>
</plist>

Save the file (Control-X) and reboot.

The Launch Agent will then run every time a user logs in, and then it'll run the shell script every time a user logs out.

Restore Failure: An error (32) occurred while copying. (Broken pipe)

The problem

If you are Cloning an image using Thunderbolt and Disk Utility (or even using Firewire instead of Thunderbolt), you may come across this error message:

brokenpipediskutility
I've actually never experienced that with Thunderbolt (not saying it can't happen), but I've had it happen twice using Firewire. At first I thought it was the cable ("broken pipe" would indicate to me a patchy physical connection of some kind), so I switched out the cable, and that didn't help. In another situation, I knew the cable was good, because I'd used it several times.

A possible solution

Try switching the direction. So if Mac A is in target disk mode and Mac B is in recovery mode, make it so Mac A is in recovery mode and Mac B is in target disk mode.

Caveat

I don't know that this is the official workaround/fix or that this will always work, but I've gotten this error twice, and this workaround/fix worked in both cases.