3

I want one of my applications to use Tor; however the app itself does not have proxy setting and it uses the System proxy. The problem is that I don't want to set my system proxy and I just want this one application to use tor.

I searched a bit for a solution, I came up with torify. I have installed tor and torify using brew and everything works fine and for example I can force curl to use tor like this: torify curl ifconfig.me 2

To use torify, I need to start my app from Terminal. For this, I use open -a myapp. However, this does not make myapp to go behind the tor proxy.I think it's because of the open command and I think I have to open myapp somehow directly. By the way, myapp does not work when I try to run it by opening the executable file inside the /Contents/MacOS folder.

Do you guys have any suggestion?

Thanks in advance

2 Answers 2

2

Tell your command where your myapp.app resides

You need to provide the open command an absolute or relative path to the application, unless the executable is already within your $PATH, or you change your working directory to the location in the filesystem where your myapp.app is (in my examples, myapp.app is the Applications folder, the home Applications folder, a folder called someotherplace, and the Shared folder, respectively).

 open /Applications/myapp.app
 open ~/Applications/myapp.app
 open ../someotherplace/myapp.app
 cd && cd ../Shared/ && open myapp.app

You can also type your open command and hit spacebar, and drag your application from anywhere into the Terminal, and the path will be provided.

There is another way

You can execute your executable using its full path and adding the ampersand. This will run it in the background so your terminal isn't tied up:

 ./myapp.app/Contents/MacOS/myapp &
 /Applications/myapp.app/Contents/MacOS/myapp &
 cd /Volumes/externaldisk/projects/thisone/myapp.app/Contents/MacOS && ./myapp &

And interestingly, using this method you can launch as many instances of your app as you have memory to do so.

To use torify with your myapp.app

I'm reasonably sure you need to launch it like this to use torify (assuming your myapp.app is in the /Applications folder):

 torify /Applications/myapp.app/Contents/MacOS/myapp &

or

 cd /Applications/myapp.app/Contents/MacOS/
 torify myapp &
3
  • I did not mean that myapp cannot run from terminal. The thing is that if I run myapp using the open command it won't run behind the Tor proxy. By the way, it does not run correctly when I open it using the binary file inside the /Contents/MacOS/ folder.
    – NEO
    May 3, 2014 at 18:01
  • I edited my question to be more understandable.
    – NEO
    May 3, 2014 at 18:08
  • brew doesn't show a formula for torify, did they removed it?
    – rraallvv
    Sep 28, 2018 at 17:52
0

You're right. open launches the program in the background, so Torify doesn't work. The solution is to start the app by directly invoking its binary. Here's how:

torify /Applications/MyApp.app/Contents/MacOS/MyApp

You must log in to answer this question.

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