How to uninstall youtube-dl

I had installed youtube-dl using these commands:

sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl

sudo chmod a+rx /usr/local/bin/youtube-dl

Now I want to uninstall it and use the official pacman package. I’ve deleted /usr/local/bin/youtube-dl and installed the official package with pacman. But whenever I run the command youtube-dl <url> bash looks for that directory. I guess this has something to do with the chmod command? how do I ‘undo’ that?

Edit: So I ran sudo chmod a+rx /usr/local/bin/youtube-dl again and that seems to have fixed the issue.

You manually created that file, so you can manually delete it.

That’s unlikely, unless you have either not deleted the file, or have a wrapper script (which is even more unlikely).

So… it sounds like you tried to “delete” the file by removing its read-execute bits (something along the lines of chmod a-rx), then you tried to use it in a terminal but got “permission denied” or something, then you added read-execute again which allowed you to run the executable once more.

Therefore - instead of running a command blindly and hoping it does what you need, try reading its documentation first. man chmod or chmod --help is a good starting place for chmod.

“How to delete a file in Linux” should be a straightforward web search, and you might also consider getting an “Introduction to Linux” book.

2 Likes

I removed the directory by using rm -r /usr/local/bin/youtube-dl.

Well I try to do that now; I installed youtube-dl when I was just new to linux (and when I thought installing something from the official website is less painful than installing a package).

1 Like

That’s not supposed to be a directory - it’s supposed to be a file. If it is a directory then you did something else in between downloading the youtube-dl executable and now.

Good. :wink:

1 Like

For future reference, you should install and update software using pacman, the Arch Linux package manager. For example, youtube-dl is in the community repository so it can be installed simply by running sudo pacman -S youtube-dl. Then, if you need to uninstall it, you can easily do so by running sudo pacman -R youtube-dl.

If the program you’re looking for is not in the Arch Linux repos, or in the EndeavourOS repo, then the first place to look for it should be the AUR. By using an AUR helper like yay installing and updating software from the AUR couldn’t be easier (but be aware of the risks involved with completely automating that process).

If the program is not in the AUR, but you can download it from the internet, you should install it manually into your home directory and just add it to the PATH variable. Personally, I have ~/bin for such things, but people often use ~/local/bin (it’s a personal preference).

In any case, if you want your system to run smoothly, anything you do manually outside the user space should be kept to a bare minimum.

4 Likes

The most recent two posts were removed because they contained a command that would be dangerous should anyone run it without understanding the consequences.

7 Likes

I agree with this statement in general, but not for youtube-dl.

It is only one file, and the devs release updates to it almost daily.

Much easier to manually check for updates to this one file using sudo youtube-dl -U than to rely on a package maintainer to keep up with the almost daily updates. Which they generally don’t, so a package maintained youtube-dl is nearly always out of date.

There have been times in the past where youtube-dl was not updated in over a month, maintainer must have been on holiday or just too busy.

What was the command?

1 Like

You should pm @dalto. As he already said it is a dangerous command if used without proper knowledge. No point posting it again. :wink:

Some crazy rm recursion performed on / :crazy_face:
Definitely not good for anyone who may find it accidentally :space_invader:

2 Likes

If you have a single user on your system then keeping it in e.g. $HOME/bin means you can run and update it without sudo rights.

Essentially a “sudo find and delete anything with youtube-dl in the path name”

2 Likes

Absolute twaddle. Jaroslav Lichtblau, the package maintainer for youtube-dl is doing an excellent job!

As someone who uses this program on a daily basis (the last two years of that being on an Arch-based distro), I have never, not once, needed to update it manually. If it stops working, the package maintainer usually has an update ready within a day, and for normal updates, it’s usually one or two days behind. This is exceptionally great, even for Arch Linux standards.

3 Likes

No it is not. Maintainers come and go, previously this has been an issue, which is exactly why I manually update ytdl daily. It is a single command updating a single file, there is no reason to rely on others to keep it up to date for you.

LOL, and here was I thinking rm -rf / was only a meme.

…two questions?

  1. Why on earth would you have to update it daily in the first place?
  2. “Maintainers come and go”… yes? that’s called Linux. Why not do this for every package then? Why rely on official repos at all if you don’t trust things to be updated?

I use it daily and it is updated by the devs on most days.

Silly statement. I explicitly said youtube-dl was an exception. Frequency of update and it is only a single file.

Not about trust at all, maintainers have busy lives like the rest of us, when I first started using it many years ago the package was mostly out of date. It is only one file and updated with a simple command, so I started doing it manually.

If things are different now then great, that is a good thing, it was not always the case.

Manually updating daily you are never one or two days behind and youtube-dl always works. The minute a dev patch is released to fix any Google YouTube whack-a-mole shenigans you can update instantly.

Like I said, youtube-dl is an exception to the rule.

1 Like