I've written this guide to assist people who want to use my terminal/command-line applications but who are somewhat nervous of the command-line itself and how to ensure an app can run on it.
Most applications are available in package managers, but this guide is specifically for apps where you've been given a download with a zip file containing an executable and that's that. My command-line apps are all like this and a good number of the ones I use are also like this too.
This guide is somewhat opinionated, but it will always try to suggest the 'correct' way to do things, while offering an alternative I personally prefer because it generally makes things easier if you are still a little nervous around terminals.
Windows
Windows is the easiest platform to set up for by far, insofar as you don't even need to interact with any terminal at all to set everything up.
You should first create a folder in a sensible location, which is where you're going to put your apps. I personally like C:\app or C:\Users\myname\app or similar. You need to choose something sensible, preferably without spaces in the entire path, and that — most importantly — is never going to change.
- You then need to open the start menu and type 'environment'. You're looking for a result called 'Edit the system environment variables', which you should click on.
- At the bottom of the little pane that opens up, click Environment Variables, which opens another little pane.
- In this pane are two sections, top and bottom. We're interested in the top one. Look for a line item that says
Pathon the left-hand side and double-click on it. - Within this new pane, you should see a short list of folder paths. You can go ahead and click 'New' on the top-right.
- You can now write or paste the file path you created at the start, such as
C:\app. If you have the folder open in the File Explorer, you can copy the path from the navigation bar at the top of the Explorer window.
Once this is complete, you can close the million little panes Windows has now opened and be sure to press Apply or Save on any one where it is relevant.
Assuming you have your application already downloaded and are in possession of an executable file like meander.exe, you just copy that file to your new folder.
Now open a brand new terminal window — if you had one open already, close it — and check your application is visible to the terminal. Other apps may be different, but mine will always print something helpful if you do one of these —
meander version
meander help
souschef version
souschef helpThe name of the command is always literally the name of the executable file, as in: meander.exe becomes meander <parameters>. If you changed it to screenplay.exe, the command would become screenplay.
If you get an error, something went wrong. Go back and check the previous steps. If you see a little message with the version number or a page of help text, you're good to go!
This also allows you to customise your text editor to run it directly too. For my editor, Sublime Text, you can just paste the basic command into a .sublime-project, like so —
"build_systems": [
{
"name": "Meander Drafts",
"working_dir": "$project_path",
"cmd": [
"meander", "$file", "--notes", "-s", "generate"
]
}
]Linux
On Linux, you can simply copy the application to your user's local bin folder —
cp path/to/meander ~/.local/bin
— or to a similar all-users one, such as /usr/local/bin.
You can also create your own app folder, like the Windows example above, but you'll need to add an export PATH line in the .profile file in your home folder using a text editor —
nano ~/.profile
— and inserting —
export PATH="~/app:$PATH"
— where app is whatever you have named your desired folder. If using nano, you can save using Ctrl+O and exit with Ctrl+X. You'll also need to log out and back in to see this reflected across all applications on the system.