Mac OS X Terminal get in Macintosh HD? For using Git and Github

5

7

I wanted to get started with using Git and Github especially for installing Web software to my htdocs directory. htdocs is the folder in which you put all your websites that then run by using MAMP -- Apache server, PHP, MySQL and stuff.

This not the real problem though, the problem is I am in the terminal and see this:

imac-van-jeroen-*******-2:~ JeroensiMac$ 

And using cd ~ or cd .. just results back in the line above, which is usual.

The problem is that all my applications and everything really is not on my user but in the Macintosh HD.

Macintosh HD/applications, or Macintosh HD/applications/MAMP/htdocs/

I want to be in the Terminal and go to my Macintosh HD (is this referred to as being superuser?).

I want to know if this is just my fault for installing everything on my Macintosh HD instead of Macintosh HD/users/JeroensiMac/~. Also I would like to know if its possible at all, and I am just missing something.

And If I am not doing anything wrong is it safe to use Git(Github) with directories in my Macintosh HD?

Jeroen

Posted 2011-01-14T12:14:37.620

Reputation: 153

Answers

10

When you open Terminal, you start out in /Users/username/, or, in short, ~. This is the same path as Macintosh HD:Users:username.

cd .. from there brings you to the parent directory /Users, or Macintosh HD:Users.


To get to Macintosh HD (which is the same as / in Terminal), enter

cd /

Your other disks are mounted in /Volumes/ (which is not visible from the Finder).


The Finder's Go to Folder... menu item uses the Unix paths (i.e. those starting with /), so it's useful to know these even if you're not often using the Terminal.


Superuser on Mac OS X refers to the root user account used for system administration and has little to do with file system paths. It's possible that your user account does not have permissions to write outside your home directory, that's what the lock icon and button are for in Get Info dialogs, or when you want to delete something your regular user account doesn't have the permission for:

alt text

You can execute a command as root in Terminal by using sudo or su. Be aware that this is dangerous if you don't know what you're doing!

Daniel Beck

Posted 2011-01-14T12:14:37.620

Reputation: 98 421

1Would it be safe to use git with these directories? – Jeroen – 2011-01-16T17:03:27.393

@Jeroen Explain what you mean by "use git". Do you want to put your whole system disk under version control? – Daniel Beck – 2011-01-16T17:11:41.593

1I am learning steadily about git and github, but what I wanted to do is to get into the 'htdocs' folder. Which means I can run websites on my localhost. The problem was I wanted to push changes using git(to the github repositories), or fork some project — being a web project — I wanted this to be in the 'htdocs' folder so I could use it. And what you showed me was how to get in this directory '/Applications/MAMP/htdocs/'. The thing I wondered in my previous comment, if this directory is a save directory to use git with(maybe I am just being stupid now). Appreciate your explanation! – Jeroen – 2011-02-28T23:09:42.963

@Jeroen You can, if what git gives you is the proper directory structure. But it'll be visible to all users of your machine. If you enable web sharing in System Preferences, you are given a link to your personal directory (http://host/~username). This is how you reach the Sites directory in your home folder. Another option is configuring Apache to provide virtual hosts, you can e.g. set up to serve any folder on hostname:81 or so. There's plenty of documentation for that online. – Daniel Beck – 2011-03-01T05:14:31.157

1

If you want to get into your Macintosh HD, you'll have to replace the Macintosh HD with simply /. For instance.

/Applications
/Applications/MAMP/htdocs/

Wuffers

Posted 2011-01-14T12:14:37.620

Reputation: 16 645