通过路径从终端运行应用程序

If I can run an app (built in Go but not really necessary) like so from its own directory:

./some_app

How can I run it from a different directory?

You should just be able to add the path to the app you are trying to run to your command. For example if the app is stored in /Users/example/apps/some_app, then you can just directly run "/Users/example/apps/some_app". You can find which directory your app is sitting in (if you are currently in that directory) with the pwd command.

Say you are in the home directory, and the app is under ~/app/some_app then you can run it with app/some_app

If you want to be able to call it with only some_app, it has to be accessible in your $PATH variable.

In go, when you do go install ./... the executable will end up in $GOPATH/bin/ which is normally part of your path if you have a correct configuration.