Showing posts with label mac. Show all posts
Showing posts with label mac. Show all posts

Friday, March 2, 2012

Disable/Enable PostgreSQL autostart in Mac OS X Lion

After installing PostgreSQL 9.1, I noticed that there is no option in its GUI to prevent it to autostart at system boot. The following commands help in disabling/renabling  autostart for PostgreSQL.

See gist at https://gist.github.com/1960888

## Stop PostgreSQL from auto starting in Mac OS X 10.7.x (Lion) sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.1.plist  ## Enable PostgreSQL to auto start in Mac OS X 10.7.x (Lion) sudo launchctl unload -w /Library/LaunchDaemons/com.edb.launchd.postgresql-9.1.plist   ## Note: ## - Without "sudo" the commands seem to run successfully but don't take effect ## - Contents of com.edb.launchd.postgresql-9.1.plist in attached file (Permission MUST be: -rw-r--r--  1 root  wheel)

Posted via email from Abhishek Dev

Monday, November 7, 2011

Fix Mac BootCamp after accidental disk (re)partition

Repartitioning your Storage Drive (e.g. shrink and resize) after installing BootCamp can corrupt the boot record for your bootcamp. Fixing this is vey simple but writing this as I can forget how to get to the beginning.

  1. From within Mac's System Preferences -> Startup Disk choose to boot from the Windows HD
  2. Restart your system
  3. Boot using the original Windows installation media. (Insert media and press "Alt/Option" during startup)
  4. Choose the option "Repair your Computer"
  5. Choose the option Startup Repair.
  6. Let the process complete and reboot.
  7. Your should have booted using the boot camp. (As we set the startup disk to windows in step 1)

 

 

Posted via email from Abhishek Dev

Tuesday, February 15, 2011

Using MySQL with Python/Django on Mac OS X (Snow Leopard)

Setting up MySQL with Python ( or Django ) can be a bit tricky since no database driver is officially provided by MySQL (as of Feb 2011). I had a couple of failed attempts, but finally got it working. A hit and trial method and troubleshooting guides from various websites helped. To sum it up, here is what worked for me:

Environment:

  1. Mac OS X 10.6.6
  2. Python 2.6.1 (Django supports this version and is installed on Mac by default if Xcode is installed)
  3. GCC 4.2.1
  4. MySQLdb 1.2.3 (Download from http://sourceforge.net/projects/mysql-python/)
  5. MySQL 5.1.x Server (Since MySQLdb supports upto this version as of Feb 2011)

Don't try to reuse the MySQL installed as part of MAMP because it doest match typical deployment environments if you would use Python/Django for professional application and secondly its overtly complicated.

Install MySQL:

See previous post Install/Uninstall MySQL 5.1 on Mac @ http://abhishekdev.posterous.com/installuninstall-mysql-51-on-mac

Perquisites: before installing MySQLdb

  1. Add the following line to the ~/.bash_profile or ~/.profile (Found by default on10.6.x) file under the User Home (if ~ is not known to you)
    PATH="${PATH}:/usr/local/mysql/bin" 
  2. Type in Terminal
    mysql --version
    Should read something similar to "mysql  Ver 14.14 Distrib 5.1.55, for apple-darwin10.3.0 (i386) using readline 5.1"

Install MySQLdb:

  1. Extract MySQLdb if it came archived/compressed
  2. Open Terminal
  3. Make the extracted folder as current working directory
    cd [Path if any]MySQL-python-1.2.3
  4. Type in Terminal
    python setup.py build sudo python setup.py install
  5. If no Errors get thrown. In Python Prompt type "import MySQLdb"
    python import MySQLdb

Posted via email from Abhishek Dev