Tonight, while trying to hack nokogiri into shape because it keeps referencing the wrong libs (due to hard-coded paths - is there any worse code smell than that?), I lost my patience and decided to delete the system libxslt dynamic library files sitting in /usr/lib.
It turns out that the terminal requires these libraries to run, or else the message is “[Process completed]”.
It also turns out that downloading alternative terminals won’t work either. I tried one called Terminator written in Java. This gave me access to a terminal, but not to sudo. Sudo uses PAM and it seems from the error messages I was getting that PAM also required the libraries I’d stuck in the trash.
Anything that required a change/check of permissions failed, so I couldn’t drag and drop the files from the trash, nor could I copy them. Admin privileges weren’t enough to save me.
In my desperation I turned to running Ruby through
do shell script in Applescript, hoping that the FileUtils library was using a low enough level C to bypass all this, but this wasn’t necessary, as you can access shell commands with sudo through Applescript. Just open up Applescript Studio in Applications/Utilities and use the following script:
display dialog "Please enter your password:" default answer "" set userpassword to text returned of result set r to "sudo mv /Users/iain/.Trash/libxslt-plugins /usr/lib/" do shell script r password userpassword with administrator privileges
Obviously you would change the command
r to whatever you needed it to be. Luckily, this worked, and as soon as the files were moved back then everything was back to normal.
Except for nokogiri.