Friday, February 22, 2013

Updated list of my GNU Make articles

CM Crossroads has reorganized their site recently. To ensure that all the latest URLs are available for my article here's an updated list.

You could buy a copy of The GNU Make Book which contains all the articles (and more!), or you could use the following list (which I've newly updated):

May 2008: Usman's Law
March 2008: GNU Make user-defined functions, part 2
February 2008: GNU Make user-defined functions, part 1
December 2007: GNU Make path handling
October 2007: GMSL 1.09: A look inside the tweaks and updates
September 2007: Makefile Debugging: An introduction to remake
July 2007: GNU Make escaping: a walk on the wild side
June 2007: Painless non-recursive Make
May 2007: Atomic Rules in GNU Make
April 2007: GNU Make meets file names with spaces in them
February 2007: GNU Make's $(shell)/environment gotcha
December 2006: Makefile Optimization $(eval) and macro caching
November 2006: The pitfalls and benefits of GNU Make parallelization
October 2006: Tips and tricks from the automatic dependency generation masters
September 2006: Sorting and Searching
August 2006: Target-specific and Pattern-specific GNU Make macros
July 2006: Making directories in GNU Make
June 2006: Rebuilding when a file's checksum changes
May 2006: What's new in GNU Make 3.81
April 2006: Tracing rule execution in GNU Make
March 2006: Rebuilding when CPPFLAGS changes
February 2006: Dynamic Breakpoints in the GNU Make Debugger
December 2005: Adding set operations to GNU Make
November 2005: What's New in GMSL 1.0.2
October 2005: An Interactive GNU Make Debugger
August 2005: Makefile Assertions
July 2005: The Trouble with $(wildcard)
June 2005: GNU Make Gotcha ifndef and ?=
March 2005: The GNU Make Standard Library
February 2005: Learning GNU Make Functions with Arithmetic
January 2005: Self-documenting Makefiles
December 2004: Learning Make with the Towers of Hanoi
November 2004: Makefile Optimization $(shell) and := go together
October 2004: Makefile Debugging: Tracing Macro Values
September 2004: Setting a Makefile variable from outside the Makefile
August 2004: The Trouble with Hidden Targets
July 2004: Dumping every Makefile variable
June 2004: Printing the value of a Makefile variable

Please let me know if any of these break.

Wednesday, February 06, 2013

How to fix a corrupted JavaScriptCore.framework on Mac OS X 10.7.5

If /System/Library/Framework/JavaScriptCore.framework gets deleted or corrupted on Mac OS X you are in serious trouble. You can't run a browser, you can't start Preview, and more. But restoring it is possible.

To save anyone else the pain of figuring this stuff out here's how I got myself out of this situation. This blog post is boring until you have this problem and end up here because you searched for a solution. Welcome!

First you need to find the 'Client Combo' from Apple for your operating system. In my case that was the OS X Lion Update 10.7.5 (Client Combo). It contains a fresh copy of the JavaScriptCore.framework that just requires extracting and copying into place. Note that you can't just install the combo from the .dmg file because the Apple package manager relies on JavaScriptCore.framework. You have to do everything at the terminal.

Step 1. Download the combo and get it on your machine. For that you need to open Terminal (which you can get via Spotlight as it will still work) and type:

curl -L > MacOSXUpdCombo10.7.5.dmg

That will create a file called MacOSXUpdCombo10.7.5.dmg.

Step 2. Extract the pkg file from inside the dmg. To do this you need to mount it (as it is a volume) by typing

hdiutil attach MacOSXUpdCombo10.7.5.dmg

This should result in the contents being available in  /Volumes/Mac OS X 10.7.5 Update Combo. So change to that directory:

cd "/Volumes/Mac OS X 10.7.5 Update Combo"

And you'll find a single file in there: MacOSXUpdCombo10.7.5.pkg.

Step 3. Extract the contents of the pkg file by typing:

pkgutil --expand MacOSXUpdCombo10.7.5.pkg ~/combo

That will extract it into a directory called combo in your home. Go there with

cd ~/combo

Step 4. In that directory you'll find a directory called MacOSXUpdCombo10.7.5.pkg, the JavaScriptCore.framework is in there but needs further extracting like this

cat MacOSXUpdCombo10.7.5.pkg/Payload | gzip -d - | cpio -im

There will now be a System directory which contains the framework needed. Delete the corrupt one and copy the new one into place:

cd System/Library/Frameworks/
sudo rm -rf /System/Library/Frameworks/JavaScriptCore.framework
sudo cp -R JavaScriptCore.framework/ /System/Library/Frameworks/JavaScriptCore.framework

and you should be fixed.