2

I know how to open it in Finder:

open .

But, how can I open it in ForkLift?

2 Answers 2

6

A little bit late to the party, anyway it's worth of better description, so here you are. Keep in mind that this answer is based on the RED's one-liner, just with some (little bit mooo...oore details ;) )

Raw command line execution

Use the following command to open the current folder (in this case, the dot represents the pwd command):

open -a ForkLift .

#or the same
open -a ForkLift `pwd`

or any other existing folder using absolute or relative path, i.e.:

# Absolute path to Apache's logs
open -a ForkLift /var/log/apache2/

# Relative path from home folder to `All Them Witches` within `Music` folder.
open -a ForkLift ~/Music/All\ Them\ Witches

# Relative from current position, ie while you're already in `~/Music` folder
open -a ForkLift All\ Them\ Witches

#or 
open -a ForkLift "All Them Witches"

What the open command does?

Check yourself in terminal with man open ;) It just opens a file or directory with default application for file type. So as you already know open . opens the current folder in the Finder, but for an instance open foo.txt will (try to) open the file in the default text editor, open foo.psd in Adobe Photoshop, generic graphic files, like open foo.jpg or open foo.png in the Macos Preview, etc.

The -a parameter for open command

Indicates which application we want to force instead of default one, the pseudo-schema would look like:

open <with-my-preferd-app> <file or directory>

so pseudo-explain of the RED's open -a ForkLift . is exactly

open <with ForkLift app in /Applications folder> <current directory>

Finally, you can use it as reference to application within Aplication folder (no need to add *.app ext then) like:

open -a Sublime\ Text foo\ file.txt

#or (other handling of spaces in app and/or file name(s))
open -a "Sublime Text" "foo file.txt"

#or (by specyfing its full, absolute path)
open -a /Applications/Sublime\ Text.app ~/Documents/foo\ file.txt

or to another app (i.e. your custom editor you wrote) in other folder than /Applications like:

open -a /full/path/to/YourOwnEditor.app bar.txt

Alias(es)

Back to the ForkLift, of course, you can add an alias to your ~/.zshrc or ~/.bashrc (depending on used shell) to replace open -a Forklift with simple forklift (or any other alias you want), like this (trailing space placed intentionally (please see below section Clarification about trailing space in alias(es)!):

alias forklift='open -a Forklift '

to open folders in FL with:

# current dir
forklift .

# or the same
forklift `pwd`

#or folder relative to your home
foklift ~/Music/All\ Them\ Witches

#or absolute path
foklift /Users/whitesiroi/Music/All\ Them\ Witches

etc, etc...

Finally following this you can add several other aliases, to open files in different editors/apps (if they are installed in your system ofc),

# Console in older Macos
alias console='open -a "/Applications/Utilities/Console.app" '

# Console in newer Macos
alias console='open -a "/System/Applications/Utilities/Console.app" '

# Sublime Text (if installed)
alias subl='open -a "Sublime Text" '

# GitHub Atom (if installed)
alias atom='open -a Atom '

# etc...
Re-load!

Don't forget to re-load your profile file after adding/modyfing/removing aliases, depending on which shell you're workin', source your profile file i.e.:

# . at the beginning is a system alias for `source` command here
. ~/.zshrc

# so you can use it also like
source ~/.zshrc

# or the same for ~/.bashrc

then just run alias command without parameters, to check if your changes are taken into account.

Optionally, instead of sourcing, you can just reset your session (close and re-open, here it comes comfortable to configure in iTerm Profile(s) for most common sessions you work every day) or create a new one.

Clarification about trailing space in alias(es):

Note, that trailing space in aliases is not mandatory, also sometimes may not work as expected, everything depends on what does your alias do. Read more about its reason and usage in another cool answer, then create the one which fits your needs correctly: https://unix.stackexchange.com/a/25329/141140

Quite safe approach is creating two aliases and test each in different scenarios, i.e.:

  • forklift - without trailing space
  • forklift-expanded with trailing space

EOF

2
  • Very detailed answer! You don't need to add trailing spaces to an alias definition though.
    – nohillside
    Commented Sep 21, 2022 at 8:49
  • @nohillside, you're almost-absoultely-right in this case it's rather kind of better safe than sorry approach, just my old habitat to do not worry about alias expansion. Feel free to check my update with clarification and/or edit it to make more sensible, I won't definitely mind. Thx in advance.
    – biesior
    Commented Sep 21, 2022 at 19:11
9

Use following command:

open -a ForkLift .
3
  • Sorry, I tried it - didn't work out. Maybe, cuz I'm using old version ^^
    – whitesiroi
    Commented Feb 23, 2017 at 8:11
  • Hi, I'm using ForkLift 3.0. Could you provide error message or any other response from the system?
    – RED
    Commented Feb 24, 2017 at 9:11
  • 1
    2.6.6, I don't get any errors - it just open ForkLift with default folder "Downloads" :) I run the command in iTerm & Terminal and in different directories, but still it starts ForkLift only with "Downloads" directory as active one.
    – whitesiroi
    Commented Feb 25, 2017 at 3:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .