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

Wednesday, February 15, 2012

Recursively chmod directories only


find . -type d -exec chmod 755 {} \;

This will recursively search your directory tree (starting at dir ‘dot’) and chmod 755 all directories only.

Similarly, the following will chmod all files only (and ignore the directories):

find . -type f -exec chmod 644 {} \;

Sunday, January 29, 2012

mac lion terminal doesn't source profile

I have encountered the problem that my MacBook Pro ~/.profile doesn't been sourced in the terminal.

The solution is simple:
bash first runs /etc/profile. /etc/profile (on Mac OS X 10.6.7) runs path_helper(8) which is where your default paths get set. After that it runs /etc/bashrc which doesn't do much. Once the default configuration is set, it moves on to the user login scripts.

bash looks in your home directory for .bash_profile, .bash_login, and .profile in that order. bash will run the first of these that it finds and stop looking.

So, if you have a .bash_profile in the home directory, the .profile will be ignored. In this case, just append a line in .bash_profile:

$cat "source ~/.profile" >> .bash_profile

Monday, September 5, 2011

Read binary in Hex

$ hexdump dog

or

$ cat dog | xxd

od -x can be used in mac, but the hight byte and low byte position is different

Thursday, September 1, 2011

Mac Dev Utilities

/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS

Monday, August 1, 2011

Monday, March 28, 2011