Jump to content

PATH in Alfred workflows


Recommended Posts

I encountered a bug in one of my workflow documented here http://www.alfredforum.com/topic/2431-weird-behavior-of-youtube-dl that is due to the fact that `youtube-dl` would not find `ffmpeg` in the PATH when launched from Alfred,

 

I fixed that with a hacky `export PATH=/usr/local/bin/:$PATH` at the start of the workflow, but how would one generally go about doing that in a more robust way ?

 

Adding to the $PATH variable or specifying full path to the external utilities you need is the method most users choose.

Link to comment

Okay, thanks for the answer

 

However, in this case it is not directly the utility I use, but rather an utility (ffmpeg) used by the utility (youtube-dl) I use. Is there a way to load the user's default $PATH variable when launching Alfred script? (it seems that the PATH must not be the correct one since it had not found `ffmpeg` :)

Link to comment

Okay, thanks for the answer

 

However, in this case it is not directly the utility I use, but rather an utility (ffmpeg) used by the utility (youtube-dl) I use. Is there a way to load the user's default $PATH variable when launching Alfred script? (it seems that the PATH must not be the correct one since it had not found `ffmpeg` :)

 

Well, yes and no. The problem is that it depends, and there is no one solution. For example, if you’ve set your PATH in your ~/.bashrc file, you can easily put something like

source "${HOME}/.bashrc"

on top of the workflow’s code, and it’ll get it (along with everything else). But what if the user did it in ~/.bash_profile, or uses another shell, like zsh? That’s why you can’t really (easily) cover every case, but can make it fit your needs with a simple tweak.

Edited by Vítor
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...