Few things you may need to know on Mac – part2
21/09/2010 § Leave a Comment
5. How can I set an alias?
You can set an alias with the command alias cdlogs=”cd /opt/prog”
but to store the alias you need to store the previous command in ~/.bash_profile
6. Where can I find my Java version running on my Mac?
which java and
java –version to know the version you’re using
7. I often download some tar or tar.gz files, what are they?
tar files are simply archived files. gz stands for Gzip, so means that the tar.gz files are archived and also Gzipped.
You usually can unzip it executing
tar xvzf file.tar.gz
or create the zip executing
tar cvzf file1.txt file2.txt
8. What’s a DAEMON?
It’s simply the equivalent of a Windows Service in Unix
Few things you may need to know on Mac – part1
13/09/2010 § 2 Comments
in this article, I will go through few gotchas you may need to know when you start using a Mac (Leopard or later version), especially for development purpose. I’m assuming that you use the Terminal, but if you don’t ,look for it and open it. Even if at the beginning it can seem a bit boring or too geeky working with a shell, it can make your life much easier and it is really powerful.
1. Does Mac have a built-in web server?
Yes, you can restart it from Console typing /usr/sbin/apachectl restart:
sebastiano:~ sebastiano$ sudo /usr/sbin/apachectl restart
and you can find the configuration file at /etc/apache2/httpd.conf (I’m using “mate” to edit it, but you can use other editors):
sebastiano:~ sebastiano$ sudo mate /etc/apache2/httpd/conf
2. Where can I put my site to be hosted by built-in web server?
Chuck your folder in ~/Sites and you can display your folder at http://localhost/~username/yoursite
or
put your files into /Library/WebServer/Documents, and you can access them on your web server at http://localhost.
3. Where can I find my host file?
Differently from Windows where you can find it at C:/Windows/System32/etc/drivers/hosts, on Mac it is located at /private/etc/hosts
sebastiano:~ sebastiano$ sudo mate /private/etc/hosts
4. Where can I find the environment variable and how can I set them?
If you type env, you can the environment variable set on your machine.
To set an environment variable on your bash shell you need to use export command such as:
sebastiano:~ sebastiano$ env
TOMCAT_HOME=/Library/Tomcat
TERM_PROGRAM=Apple_Terminal
TERM=xterm-color
SHELL=/bin/bash
sebastiano:~ sebastiano$ export JAVA_HOME=/Library/Java/Home
but if you want to store it, so that at the next access you still find this variable, you need to store it in /etc/bashrc