Archive

Posts Tagged ‘Unix’

Mac OS X Package Management with Homebrew

December 13, 2010 Leave a comment

So I reformatted my Macbook Pro over the weekend and deceided to give Homebrew a try. So whats homebrew. Its a package management tool for Mac OS X developed in Ruby. Its really great. I can install library I want and the dependencies are also automatically installed. I really like it.

To get started make sure you install Xcode which is a requirement.

You can install by executing the following statement in the terminal.

ruby -e "$(curl -fsSL https://gist.github.com/raw/323731/install_homebrew.rb)"

Now your done.

Ok lets install some packages now 🙂

brew install git

This will install git to /usr/local/Cellar/git. Package are installed under the /usr/local/Cellar folder and are often symlinked to /usr/local/bin.

Removing a package is also easy.

brew remove git

You can get a list of packages available from https://github.com/mxcl/homebrew/tree/master/Library/Formula/

You can also search for packages using the following command.

brew search packagename

You can also information on packages using the following command.

brew info packagename

You can also update homebrew using the following command. You must have git installed to update.

brew update

There we go.

Hope this helps.

Blair

Using syslog on Mac OS X in C/C++

May 30, 2010 Leave a comment

Just posting some code on how to write to the syslog in unix. Maybe the title of the post is mis-leading as this should work on all unix based systems. I guess I am just doing it on OS X.

#include <syslog.h>
#include <iostream>
#include <string>
using namespace std;

void writeMessageToSyslogd(const char* message);

int main(int argc, char *argv[])
{
    writeMessageToSyslogd("Blair is writing to syslog");
    return 0;
}

void writeMessageToSyslogd(const char* message){
    openlog("Demo",LOG_CONS,LOG_USER);
    syslog(LOG_ERR,message);
    closelog();
}

Blair…

Categories: Development Tags: , , , , ,

Mac OS X Terminal

May 13, 2010 Leave a comment

I just read a post on Brad Wilson’s blog on customising your terminal. Here is the .profile file.

alias ls=’ls -G’
alias dir=’ls -l’

alias autofeature=’AUTOFEATURE=true autospec’

export PS1=”\e[0;34m[\$PWD]\e[0m ”
Comes with directory highlighting. Dont know why this is not the OS X default.

Awesome anyways.

Blair…

Categories: Development Tags: , , ,