Resizing Coda’s file dialog on OS X Yosemite

Google Chrome is not the only application struggling with OS X Yosemite’s file dialog. When saving files in Coda, the dialog will continually fall off the bottom of the screen.

Currently the only known workaround for the issue is to switch to the simple view by clicking the up arrow next to the file name box, and then click it again to re-expand the dialog and then it will be probably sized again. However, you need to do this every time you save a file.

Resizing Google Chrome’s file dialog on OS X Yosemite

There is a bug in Apple’s OS X Yosemite in which the file dialog boxes grow larger than the screen. However, it does not seem Apple are in a rush to fix this.

The workaround is different for each application but for Google Chrome you can temporary solve it by running the following commands.

defaults delete NSNavPanelExpandedSizeForSaveMode
defaults delete NSNavPanelExpandedSizeForOpenMode

The box will continue to grow each time you use it, so you will have to run these commands again every time the box gets too big again.

Error resolving hostname on SSH tunnels

Lets say you are trying to create an SSH tunnel.

ssh -L 27017:somehost:27017

You may get the following error message.

ssh: Error resolving hostname \342\200\223L: nodename nor servname provided, or not known

This is caused by using the wrong kind of minus symbol. If you have copied and pasted the command from somewhere, this is probably the case. This is easy to fix – simply paste the command into your terminal, then go through it, remove the existing minus symbol and put a new – in.

MacPorts mysql5-server not working on boot

If you’ve installed MacPorts’ mysql5-server, you may find that it doesn’t work after a restart.

This can be resolved by running the following commands to make sure you’ve killed off everything MySQL related.

sudo port unload mysql5-server
ps -ax | grep mysql
sudo kill 

Once you have done this, load it again.

sudo port load mysql5-server

Not it should be working. This is fine, but quickly gets very annoying every time you restart your computer! A common cause is that you have a MySQL sock file in your tmp directory. Removing this may allow it to start automatically.

cd /tmp
rm -f mysql.sock

Once removed, restart your computer and see if MySQL works first time – hopefully, it will.

No acceptable C compiler found on Mac

If you’re trying to compile from source, you may get an error similar to the following.

mac configure: error: no acceptable C compiler found in $PATH

This may be because you haven’t installed Xcode. If you have, something has broken, and you need to reinstall it. First, remove it with the following command.

mac configure: error: no acceptable C compiler found in $PATH

Now restart your system and once it has started again, go to Applications and select Install Xcode. This will reinstall it.

Imagick not loading on MAMP for Mac

If you’re running MAMP and you’ve finally managed to get the Imagick extension to add ImageMagick support compiled, the battle may not be over yet. There are more things you need to do. You might get an error similar to the following.

Firstly, was probably installed into the sytem’s PHP extension directory. So you might need to copy this into MAMP’s directory. Don’t just copy and paste the code below as you need to check the paths are correct for your system.

php -i | grep extension_dir
cp /usr/lib/php/extensions/no-debug-non-zts-20090626/

Secondly, some of the libraries are out of date. You might get an error like the following.

[01-Jun-2012 08:46:22] PHP Warning:  PHP Startup: Unable to load dynamic library 
 - dlopen(/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/, 9): Library not loaded: /opt/local/lib/libjpeg.8.dylib
  Referenced from: /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/
  Reason: Incompatible library version: requires version 13.0.0 or later,
but libjpeg.8.dylib provides version 12.0.0 in Unknown on line 0
[01-Jun-2012 08:51:54] PHP Warning:  PHP Startup: Unable to load dynamic library '/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/' - dlopen(/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/, 9):
image not found in Unknown on line 0

We can solve this by editing a configuration file.

sudo vim /Applications/MAMP/Library/bin/envvars

Comment out the first two lines below and add the last one.

export PATH="$PATH:/opt/local/bin"

This should override out of date libraries such as libjpeg. If you’re still having problems, you can manually copy in the freetype library too.

cp /opt/local/lib/libfreetype.6.dylib /Applications/MAMP/Library/lib/

Though in theory this step should not be required. Restart Apache and you should see Imagick appear on the phpinfo() output.

Installing ImageMagick and Imagick on Mac OS X

Trying to get ImageMagick and it’s PHP extension working on OS X Lion is a frustrating process. It will often fail and even if you try to configure it manually you may get an error like the following.

checking ImageMagick MagickWand API configuration program...
configure: error: not found. Please provide a path to MagickWand-config or Wand-config program.

First of all, install ImageMagick via MacPorts.

sudo port install ImageMagick

Now install the imagick PECL module.

sudo pecl install imagick

Very importantly however, make sure you specify the path when prompted, to be /opt/local, do not let it auto detect! Once this is done it should compile successfully and you will be prompted to add to your php.ini file.

Using whereis on Mac OS X Lion

Linux has a great tool called whereis that allows you to find the location of an executable. For example, if you want to know what PHP binary you are using, you could use the following command.

$ whereis php

However, if you run this on Mac it will often return you a black result, even though you know the command works!

$ whereis convert

The solution is to use which instead, which does the the same thing, but actually returns results.

$ which convert

Great for finding those extra mysterious programmes.

Navigating VIM on Mac keyboards

If you’re trying to get around documents in VIM using a Mac keyboard, you may feel fairly stumped without a page up and page down button. But you need not be!

VIM has an extensive set of commands, including moving backwards and forwards through a document a page at a time. They are logically named too – Ctrl+F will go forward a page and Ctrl+B will go back a page.