Tag Archives: Os X

Os X Preferences stopped working? There is a fix for that!

Recently I’ve noticed that my Preferences started behaving strangely. Only main panes would open, but no secondary windows would work. For example I could open network preferences and delete all interfaces, but clicking plus button to add new did not work. Which quickly left me with no network on my machine :-)

Some googling later and it seems to be an issue carried over from times when my machine had Leopard installed and some preferences were saved on the disk and carried over. Here is the fix:

defaults delete NSGlobalDomain NSUseLeopardWindowValues
defaults delete com.apple.Safari NSUseLeopardWindowValues
defaults delete -g AppleUseCoreUI
killall SystemUIServer

Zend Studio running out of memory? There’s a fix for that!

Recently while working in Zend Studio I had couple of crashes that I finally traced down to it running out of memory. After searching around I found that you can bump up it’s default settings by editing it’s .ini file.

The file is located in /Applications/Zend Studio.app/Contents/MacOS

# cat ZendStudio.ini
Zend Studio

The settings that you need to bump are Xms and Xmx (in case above they are already bumped up.

My Zend Studie has not crashed since. Happy coding!

Using built in Postgres 9.1.5 on Os X Mountain Lion (10.8)

I’ve been using Postgres db server for years in my day job. And for all those years I had a third party server installed on my Mac. But since Apple started bundling Postgres in Os X system I was thinking of ways to start using that one. Unfortunately it seems that Apple decided to make using it as hard as it’s possible so getting it to work needed some hacking.

The application I’m working with accesses db via network connection on localhost. So I needed to turn on listening on network interfaces. Postgres keeps it’s config file in /Library/Server/PostgreSQL/Data folder. You can find postgres.conf there. You need to edit this file and change two lines to show this:

port = 5432 # (change requires restart)
listen_addresses = '*' # what IP address(es) to listen on;

quick server restart:

# sudo serveradmin stop postgres
postgres:state = "STOPPED"
# sudo serveradmin start postgres
postgres:state = "RUNNING"

and… no luck. Still no connections are accepted on network interface. Checking settings:

# sudo serveradmin settings postgres
postgres:log_connections = "on"
postgres:unix_socket_directory = "/var/pgsql_socket"
postgres:listen_addresses = ""
postgres:unix_socket_group = "_postgres"
postgres:log_statement = "ddl"
postgres:log_line_prefix = "%t "
postgres:unix_socket_permissions = "0770"
postgres:log_lock_waits = "on"
postgres:logging_collector = "on"
postgres:log_filename = "PostgreSQL.log"
postgres:dataDir = "/Library/Server/PostgreSQL/Data"
postgres:log_directory = "/Library/Logs/PostgreSQL"

Shows that the listen_address parameter got somehow overwritten. It turns out that the server stores some parameters in plist files and those get priority over anything you set in postgres.conf file.

# sudo serveradmin set postgres:listen_addresses="*"
postgres:listen_addresses = "*"

changes that and now my application can access built in Postgres server on localhost.

But how about command line tools? Apple sets things up in a way that Postgres accepts socket connection only from users that belong to _postgres group. Now I needed to add myself to that group using dseditgroup command:

# sudo dseditgroup -o edit -a usertoaddtogroup -t user _postgres

and voila! I’ve gut running instance of Postgres (9.1.5) accepting connection from my application and letting me use all command line tools.

Apple fusion drive on late 2010 MacBook Pro

Inspired by an Jinx’s article about building your own Apple fusion drive I’ve decided to take it one step further and brew my own with full Os X installation on it.

Here is how I did it.

First things first, I needed to put two drives in my Mac. I already had Crucial M4 SSD and 500GB HDD so I bought hard drive caddy and put my 500GB Momentus XT in it:

Here you can see both my SSD and HDD installed in late 2010 unibody MacBook Pro:

That was the easy part. Now how to make them work? I Jinx’s article you can read that GUI Disk Util does not offer needed functionality. It’s available only in command line version. But from my previous installation I remembered that there is acces to terminal in Os X recovery mode:

It was downhill from there. Create Logical Volume Group:

get UUID:

Create volume:

As you can see Os X Installation recognized such volume:

and installed nicely. After the whole process was over I’ve done similar to Jinx’s tests and the drive indeed behaves like fusion – more often used files end up on the SSD and less needed are being shuffled to the HDD.

Mission accomplished!

Ubuntu NAS vs. OS X Lion 10.7

Today when I woke up my MacBook greeted me with very unpleasant alert:

The network backup disk does not support the required AFP features.

It turnes out that during the upgrade to Lion Apple used their newest set of commands that were not compatible with stable netatalk package in Ubuntu.
To get my network storage to work again I had to upgrade to the latest netatalk 2.2.beta4.

First download all needed files from Ubuntu’s repositories

wget http://launchpadlibrarian.net/73070555/netatalk_2.2~beta4-1_amd64.deb
wget http://launchpadlibrarian.net/74978789/libgcrypt11_1.5.0-1_amd64.deb
wget http://launchpadlibrarian.net/75629511/multiarch-support_2.13-9ubuntu3_amd64.deb
wget http://launchpadlibrarian.net/72120162/libgpg-error0_1.10-0.3ubuntu1_amd64.deb
wget http://launchpadlibrarian.net/74358655/libdb5.1_5.1.25-11_amd64.deb

Then install it:

dpkg -i multiarch-support_2.13-9ubuntu3_amd64.deb
dpkg -i libgpg-error0_1.10-0.3ubuntu1_amd64.deb
dpkg -i libgcrypt11_1.5.0-1_amd64.deb
dpkg -i libdb5.1_5.1.25-11_amd64.deb
dpkg -i netatalk_2.2~beta4-1_amd64.deb

I’ve chosen to keep old version of configuration files, the only notable difference was that now afpd.conf lists -tcp -noddp options as defaults. I added them to my list. Quick restart of netatalk daemon and voila – Time Machine works again.