chbrown / overdrive

Bash script to download mp3s from the OverDrive audiobook service

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Permission denied when trying to install on Mac

dconley01 opened this issue · comments

Hello! When I try to starting the installation process using the

curl https://chbrown.github.io/overdrive/overdrive.sh > /usr/local/bin/overdrive
chmod +x /usr/local/bin/overdrive

in my Mac terminal, it tells me that permission is denied. How can I fix this?

Hi! First off, be sure you're running those as two different commands, not on the same line :)

More to the point... I'm not sure which of the two commands is failing with the "permission denied" error, but if it's the chmod ..., you may need to call it with sudo, i.e.,

sudo chmod +x /usr/local/bin/overdrive

and enter your password when requested.

Alternatively...

You don't have to install the script into /usr/local/bin, but that's usually on users' PATH, so it's convenient. If you have trouble with sudo or whatever, you can avoid worrying about permissions and just put the script in your HOME folder:

curl https://chbrown.github.io/overdrive/overdrive.sh > ~/overdrive
chmod +x ~/overdrive

Then, instead of running it like most of the examples in the README, e.g., overdrive --help, you'll have to run ~/overdrive --help.
Not quite as pretty, but works exactly the same.

So I was entering it in as one line, but it seems that the "curl https://chbrown.github.io/overdrive/overdrive.sh > /usr/local/bin/overdrive: is the denied one. I tried entering it as "sudo curl https://chbrown.github.io/overdrive/overdrive.sh > /usr/local/bin/overdrive" and still was denied. Any idea?

Ah 😞 that's because sudo only affects the immediate command (curl), not the shell redirection part, i.e., the > and subsequent filepath.

To do it all with sudo:

Download the script:

sudo curl https://chbrown.github.io/overdrive/overdrive.sh -o /usr/local/bin/overdrive

Then mark it executable:

sudo chmod +x /usr/local/bin/overdrive

Great, it's installed! But is it ready to use?

Ensure /usr/local/bin is on your PATH:

echo $PATH

(/usr/local/bin should be in there somewhere as one of the :-separated paths)

If it's not, you'll need to call this:

export PATH="/usr/local/bin:$PATH"

and you'll need to call that every time you open a new terminal unless you add it to your shell startup scripts.

Be optimistic!

At this point, the examples from the README should (:pray) work.

so I actually had to and use the root shell to install it for some reason, but when I try to download it now, it says the command is not found? I checked the readme but there doesn't seem to be anything in it about that?

Yeah if you see something like

-bash: overdrive: command not found

that means it might be: a) not on your PATH, or b) not executable, or both. See the "But is it ready to use?" section from my last comment.

At this point I'm also inclined to (re-)suggest using it like I described in the "Alternatively..." section in my first comment on this issue :)

Generating random ClientID=37518480-7ED9-41EC-B712-D73EF22B616E
/usr/local/bin/overdrive: line 70: xmlstarlet: command not found This is what I see when I try to download after trying to execute the path.

And I tried running it that way, but even though it installed, it is giving me the same line 70 xmstarlet not found.

Do I have to return the license file? Or if I return the load will, can I just delete that file?

Oooh, that's progress though!

Sounds like you don't have xmlstarlet installed. Easiest way is probably to install Homebrew and use it to install xmlstarlet: brew install xmlstarlet.

Sorry for yet-one-more-thing-to-do but most of the interesting stuff the overdrive script actually performs involves extracting specific fields from XML, so it's not practically avoidable.

Good luck! Homebrew is totally worth it, and going through that install process will alleviate some of the pains you're having with permissions and executables and PATH :)

Progress is good!

I just installed both of those and while it still denies me the permission, I am able to go about it the alternate way! Thank you so much! This is going to help me continue going to school! When I finish, do I have to return the license file or can I just delete it and return the loan?

Glad to hear it works, one way or another :)

AFAIK there's no difference between returning the loan using overdrive return *.odm (or using their app) and returning it on the library website, or simply waiting until your loan expires.

FYI: when returning a loan using the CLI script in this repo, you don't give it the .odm.license file, but the original .odm that you downloaded from your library's website.

You can email me but if it's about this repo and there's a chance some other overdrive user might find the answer useful, I will not answer you by email.

I downloaded it successfully (after being unable to) using:

curl https://chbrown.github.io/overdrive/overdrive.sh > ~/overdrive

I confirmed it's correctly on my path using:

~/overdrive --help

But I keep getting -bash command not found errors when downloading.

From what I'm reading, this may be do to me not making it executable. But when I try to make it executable by using:

sudo chmod +x /usr/local/bin/overdrive

I get the same No such file or directory error.

Perhaps I'm not redirecting it properly with ~/overdrive?

The Install instructions in the README and the Alternatively... approach described earlier in this thread are totally distinct.

If ~/overdrive --help works (it should print out Usage: overdrive command ... followed by the other options and a Commands section), great! Just continue with the rest of the instructions from the README, replacing e.g. overdrive return Novel.odm with ~/overdrive return Novel.odm.


The entire functionality (outside of the external commands it calls, like xmlstarlet) exists in the single script you downloaded, so it doesn't matter where you install it to. Putting it in the /usr/local/bin/ directory is just a sort of filesystem organization 'best practice', but by no means necessary. For instance, another common practice (which is probably how I'll rewrite the README) is to put such executable scripts into ~/.local/bin/ (which wouldn't require any sudo'ing) and ensure that's on your PATH, which would only have a tangible effect if you're using a multi-user computer, because other users wouldn't be able to use the script (which might be what you want in some cases).

Finally got it after (had to install home-brew then xmlstarlet first). Fantastic. Thank you so much for this tool and the wonderful support. Hopefully, this thread will help others (and save you some support time!). Thanks again!

Congrats! Glad you got it working.

Looks like it's already paying dividends — you figured it out after just two (new) Q&A's 😄