Fix “photos library is in use by another program” Error in OSX Photos

If database repair fails (holding cmd+option on Photos start-up) and you still get the “photos library is in use by another program” error, then you have to manually delete the lockfile.

  1. Find your Photos Library.  Most likely in /Users/[you]/Pictures/Photos Library.
  2. Right-click/ctrl-click the package and select “Show Package Contents”
  3. Navigate to the “database” folder
  4. Delete the “photos.db.lock” file
  5. Restart Photos

Hide Folders in Finder

to hide: setfile -a V FolderName
to show: setfile -a v FolderName

10.7.4 upgrade hackintosh

add Vendor /Device ID to /System/Library/Extension/AppleGraphicsPowerManagement.kext

my hackintosh masquerades as a MacPro5,1, so under that section, i add:



“10de” is the vendor trailing bits from the Graphics/Display output of System Info (0x10de)

“1086” is the device ID found in the same.


Install Nvidia drivers for OSX (must be done as MacPro5,1), and you should be good-to-go.

Hackintosh on Asus P8Z68-V Pro Gen3

If simply booting off the installer disk is not working, use “-v -x” as boot flag args in Unibeast.  On my build, USB devices (maybe the root hub?) would not initialize without those arguments; if you can’t use a keyboard or mouse, it’s pretty difficult to customize the install.

Use Unibeast with OSX 10.7.2 from App Store, creating USB installer.

Follow deadMetal’s instructions:

BIOS version is 3xxx series, meaning downgrading ran serious risk of bricking BIOS/mobo, so opting to use SpeedStepper for sleep/APM.

SpeedStepper for Lion 10.7.3:

When migrating (read: reinstalling for practice) my original install from a 300Gb spinning HDD I had laying around to a brand, spanking new Intel 520 SSD, I hit a few gotchas:

Got a kernel panic, wrt:

The stacktrace:

Kernel Extensions in backtrace(with dependencies):>0x2f5d0fff
The solution: delete it.
  1. restart in single-user mode. Add args on startup: -s
  2. in the root terminal after loading is finished, run the following:
    • mount -uw /
    • rm -rf /System/Library/Extensions/AppleTyMCEDriver.kext
    • exit

Disable Parallels Registration Popup Prompt

If you own a copy of Parallels 5+ (I’m currently on 6) and you don’t register your license to your Parallels account, every 3 days you will get a prompt to register your copy. For individual licensees, this is probably not an issue (excepting the extremely paranoid), but for IT admin types who rollout managed software packages to their users, this becomes a never-ending stream of fix tickets.

The following is a brilliant bit of scripting that will find all Parallels licenses and flag OFF the prompt.

defaults read "com.parallels.Parallels Desktop" | grep "Register.Show Welcome Dialog" | sed "s/.*{\(.*\)}.*/\1/" | while read id; do defaults write "com.parallels.Parallels Desktop" "Register.Show Welcome Dialog.{$id}" -bool NO; done;

Found in this post in the Parallels forum: relevant post

PHP Dynamic Modules Mac OS X

My development machine is currently a MacBook Pro Core2Duo.  It also happens to use a 64bit architecture.  My previous machine was a MacBook Pro CoreDuo which was 32bit.

Compiling a simple dynamic extension for PHP became something of an issue when moving on to the newer MBP.

I was trying to install the RAR extension for PHP on my dev laptop to test a few unrelated bits and I got mired in the process of getting this damned extension to load for Apache.  My error logs, enabled just to debug this process, were filling up with:

PHP Warning:  PHP Startup: Unable to load dynamic library ‘/usr/lib/php/extensions/no-debug-non-zts-20060613/’ – (null) in Unknown on line 0

Every page that describes the process had the same steps.  Get archive.  Untar,  ./configure, make, make install, make test, add  Blah blah blah.  One typical test was to run the CLI version of PHP and confirm that the dynamic extension was loading and was not causing startup errors:

php -i | grep rar


php -m | grep rar

Yep.  No problems.  I could even run tests like:

php -r “echo rar_open(‘myRar.rar’);”

The above would give me the internal ID for the rar object handle.  Great!  I was in business.  However, after bouncing Apache 2, my phpinfo() page failed to show RAR as a loaded extension.  The above impromtu tests confirmed that the proper modifications to php.ini and paths to my extensions_dir were correctly set.  WTF?

Doing some serious googling, I stumbled on a thread off of Marc Liyanage’s invaluable Mac OS X PHP site

MACOSX_DEPLOYMENT_TARGET=10.5 CFLAGS=”-arch x86_64 -g -Os -pipe -no-cpp-precomp” CCFLAGS=”-arch x86_64 -g -Os -pipe” CXXFLAGS=”-arch x86_64 -g -Os -pipe” LDFLAGS=”-arch x86_64 -bind_at_load” ./configure

To sum it up in one line, compiling a dynamic extension for PHP may default to a 32bit architecture.  This will fail when PHP as a DSO for Apache 2 is compiled against 64bit libs.

The punchline?  RAR now loads for Apache as intended and works a charm.  The CLI version complains every time I invoke it :).

Mac OSX Command Line Notes

To flush DNS cache:

sudo dscacheutil -flushcache

To mount a DMG:

hdiutil attach ‘/path/to/dmg’

To install a .pkg or .mpkg

sudo installer -pkg ‘/path/to/pkg’ -target /

To unset the “locked” flag on files (usually copied as read-only from another system):

chflags nouchg [file name]

To use find and xargs to do interesting things to LARGE lists of files (“xxx” can be any unique sequence of characters.  Most online examples use … -I “{}” …):

find . -name *.txt | xargs –Ixxx rm xxx

To get a quick count of files in a directory/diretories without counting meta files (files/folders that start with “.”):

ls | wc -l

To en|disable Spotlight in Mac OSX:

sudo mdutil -a -i off|on

To remove the menu bar icon:

sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search

killall SystemUIServer