Search code examples
command-linecoda

Cant access Coda application from command-line


I am having trouble accessing Coda from command-line. I installed the "command-line coda" plug-in, verified that my installation is in the correct location, yet I still can seem to access Coda. Coda sits in my "Applications" folder which is the default location for the plug-in.

Anyone have have this problem? Any tips? On the their site it is recommended that you change the path.

export CODEPATH=/Applications/Coda.app

So I included the above line in my .bash_profile which did not help.

$ Coda -v
-bash: Coda: command not found

Thanks for any direction you can provide.


Solution

  • The default way to open an application on a Mac is to use open -a AppName so you should be able to change your bash profile to use that:

    $ open -a Coda
    

    I've created a bash script (as opposed to using the plugin) that Gregory Tomlinson originally posted about (it looks like he's since taken it down but it looks like the following).

    Create a new file in /bin called coda:

    $ cd /bin
    $ sudo touch coda
    $ vim coda
    

    Hit an i to enter insert mode. Then include the following code:

    #! /bin/bash
    if [ "$1" = "" ]; then
        echo "Please specify a file to open or create"
        exit 0
    else
        for ARG in $*
            do
                touch -a $ARG && open -a Coda $ARG 
            done
        exit 0
    fi
    

    Save and quit (hit the esc to exit insert mode then type :w !sudo tee % >/dev/null followed by the return key, press L for load when prompted, then type :q to quit). Then give that file execute permissions:

    $ chmod u+x coda
    

    Start a new Terminal window and you should be able to use:

    $ coda filename.foo
    

    Or just:

    $ coda