Terminal- Changing directories to app folders

Discussion in 'macOS' started by Jwalker7, Oct 4, 2010.

  1. Jwalker7 macrumors newbie

    Oct 4, 2010
    I just started a new job and they have me working on mac since I have some basic experience. Anyways I'm working with files within an app and trying to use terminal to access some of those files.

    The issue comes up when I try to change the directory in terminal to the app (/user/applications/app.app/folder). I can get into the user directory or the app directory but it won't let me into the app. I have never really used terminal before so I don't know what I should be expecting here.
  2. maflynn Moderator


    Staff Member

    May 3, 2009
    Most applications are stored /Applications not /user/applications
  3. LPZ macrumors 65816

    Jul 11, 2006
    If you have an admin account you should be able to do something like

    cd /Applications/Safari.app/Contents/MacOS/
    without any problems.

    If you can't, then it's most likely a permissions issue.
  4. maflynn Moderator


    Staff Member

    May 3, 2009
    Also if you're looking to start the application from the terminal then you want to use open <application> Like open iTunes.app
  5. Jwalker7 thread starter macrumors newbie

    Oct 4, 2010
    The specific app is only stored on my admin account (which I am using) under /user/applications. When I input that string it gives me a message saying "No such file or directory".I repaired the permissions for the disk using the disk utility but its still not working. I also tried it on another mac in my department and had the same problem
  6. LPZ macrumors 65816

    Jul 11, 2006
    In Terminal, enter

    cd ~; ls -al
    Please post the output.

    Also, enter

    cd ~/applications; ls -al
    and post the output.

    And maybe also

    cd ~/user/applications; ls -al
  7. plinden macrumors 68040


    Apr 8, 2004
    It's unlikely to be /user/applications. Try /Users/<your acccount>/Applications.

    Make sure you capitalize correctly.

    And make sure you understand how directories work in Terminal. "/" is the top level (aka root ... nothing to do with the root user) directory. "/user" is a directory called "user" directly under root. "/user/applications" would be a subdirectory "applications" under "user" under the root. If there is no "user" directory under "/" you'd get "No such file or directory", and if there's no "applications" directory under "/user" you'd get the same error.
  8. Ganesha macrumors regular

    Aug 4, 2009
    Easier to use Terminal's drag and drop capability in this case. Type 'cd ' and then drag and drop application icon onto the terminal window.
  9. Hal Itosis macrumors 6502a

    Hal Itosis

    Feb 20, 2010
    One day you'll come back here to read that post and chuckle... because there's so much 'wrong' in there, it's hard to know where to begin. Fortunately, others have pointed out that "/user/applications" is one highly unlikely path... so Terminal's response (no such file or directory) is most certainly right on the money. Along with the drag-n-drop method suggested by Ganesha, we can also use copy/paste (from Finder to Terminal) in much the same way.

    A third technique to obtain the proper path is by using tab-completion.


    cd /u<tab>/j<tab>/a<tab>/c<tab>/c<tab>

    Depending on the existence of such items, the (auto-formatted) result on the command line might end up looking something like this:

    cd /Users/jwalker/Applications/Carbon\ Copy\ Cloner.app/Contents

    The idea is to let Readline do the heavy lifting: it sees what filesystem objects (or commands) actually exist, it fills out a possible pathname each time tab is pressed, and it handles the formatting of all oddball characters in the name (not just spaces, but single quotes, slashes and other punctuation, whatever).

    For better efficiency, we sometimes need to type more than one letter before hitting the tab key. And sometimes we'll need to hit tab two or three (or more) times in a row before we match the item we're after. Regardless, it's a huge timesaver.

    FWIW, I use the following Readline bindings (which get sourced from my ~/.bashrc file):

    bind '"\t": menu-complete'
    bind '"\e\t": complete-command'
    bind 'set completion-ignore-case on'
    bind 'set mark-directories off'
    bind 'set show-all-if-ambiguous on'

    [those can also be entered right on the command line, so you can try before you buy.]

    Repairing permissions does absolutely nothing inside anyone's *home* folder. EDIT: pluswhich —if permissions were the problem, then —the message from Terminal would have been "Permission denied". When the error comes back as "No such file or directory", the problem is typically exactly that. [wrong pathname, or right pathname to an item that's missing.]


    PS: learn how to master the ls (list) command, so you can see what's what (and where). E.g., if cd claims some file or directory doesn't exist... then use ls to see what does exist. Mistakes such as these (blindly entering a path) with the rm command are often far less amusing.

Share This Page