Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bat doesn't work when installed from apt on Ubuntu #1420

Closed
marimeireles opened this issue Dec 2, 2020 · 13 comments
Closed

Bat doesn't work when installed from apt on Ubuntu #1420

marimeireles opened this issue Dec 2, 2020 · 13 comments

Comments

@marimeireles
Copy link

What version of bat are you using?
The one available on apt.

Describe the bug you encountered:
When I sudo apt install bat the installation works as expected, but when I bat I get:

zsh: command not found: bat
system
------

**$ uname -srm**
Linux 5.4.0-53-generic x86_64  

**$ lsb_release -a**
No LSB modules are available.  
Distributor ID:	Ubuntu  
Description:	Ubuntu 20.04.1 LTS  
Release:	20.04  
Codename:	focal  

bat
---

**$ bat --version**
bat 0.17.1  

**$ env**
PAGER=less  

bat_config
----------

bat_wrapper
-----------

No wrapper script for 'bat'.

bat_wrapper_function
--------------------

No wrapper function for 'bat'.

No wrapper function for 'cat'.

tool
----

**$ less --version**
less 551 (GNU regular expressions)  
@marimeireles marimeireles added the bug Something isn't working label Dec 2, 2020
@marimeireles
Copy link
Author

It works when I install it from source.

@keith-hall
Copy link
Collaborator

https://github.com/sharkdp/bat#on-ubuntu-using-apt

If you install bat this way, please note that the executable may be installed as batcat instead of bat (due to a name clash with another package). You can set up a bat -> batcat symlink or alias to prevent any issues that may come up because of this and to be consistent with other distributions:

mkdir -p ~/.local/bin
ln -s /usr/bin/batcat ~/.local/bin/bat

@marimeireles
Copy link
Author

That was my problem! Sorry for the issue.
Might be worth it adding to the readme as a footnote?
Thanks!

@sharkdp sharkdp added documentation and removed bug Something isn't working labels Dec 17, 2020
@sharkdp
Copy link
Owner

sharkdp commented Dec 17, 2020

@marimeireles Do you think we could improve the documentation to prevent this confusion in the future? Maybe we can highlight or move that part in the documentation to make it more visible?

@marimeireles
Copy link
Author

Oh, no, it was my fault. I was super inattentive like twice.
IMO we can close this.
Thanks for the help @sharkdp :)

@sharkdp
Copy link
Owner

sharkdp commented Dec 21, 2020

It did happen to many others as well. I added "Important:" in the README 😄

@tanuj-05
Copy link

tanuj-05 commented Aug 2, 2021

https://github.com/sharkdp/bat#on-ubuntu-using-apt

If you install bat this way, please note that the executable may be installed as batcat instead of bat (due to a name clash with another package). You can set up a bat -> batcat symlink or alias to prevent any issues that may come up because of this and to be consistent with other distributions:

mkdir -p ~/.local/bin
ln -s /usr/bin/batcat ~/.local/bin/bat

I ran these commands but I am still not able to use 'bat'. Only batcat works. Any help will be much appreciated, thanks !

@mehdiMj-ir
Copy link

https://github.com/sharkdp/bat#on-ubuntu-using-apt

If you install bat this way, please note that the executable may be installed as batcat instead of bat (due to a name clash with another package). You can set up a bat -> batcat symlink or alias to prevent any issues that may come up because of this and to be consistent with other distributions:

mkdir -p ~/.local/bin
ln -s /usr/bin/batcat ~/.local/bin/bat

I ran these commands but I am still not able to use 'bat'. Only batcat works. Any help will be much appreciated, thanks !

You could alias it on .bashrc or .zshrc like this ->

alias bat='batcat'

@tanuj-05
Copy link

https://github.com/sharkdp/bat#on-ubuntu-using-apt

If you install bat this way, please note that the executable may be installed as batcat instead of bat (due to a name clash with another package). You can set up a bat -> batcat symlink or alias to prevent any issues that may come up because of this and to be consistent with other distributions:

mkdir -p ~/.local/bin
ln -s /usr/bin/batcat ~/.local/bin/bat

I ran these commands but I am still not able to use 'bat'. Only batcat works. Any help will be much appreciated, thanks !

You could alias it on .bashrc or .zshrc like this ->

alias bat='batcat'

Thanks!

@mnpenner
Copy link

mnpenner commented Oct 22, 2021

I like to put it in /usr/local/bin instead of my home dir.

sudo ln -s /usr/bin/batcat /usr/local/bin/bat

~/.local/bin isn't always on your $PATH.

@DrPepperBianco
Copy link

Why is this issue closed? - The problem is not solved. Only a workaround is presented here.

I installed bat via 'apt'. If I then call 'man bat' the documentation clearly states, that the command is 'bat' not 'batcat'!

I'm very confused by that. The solution works, but obviously has to be done by every user. Why isn't this done automatically on install? (Does this have to do with name collissions?)

@sharkdp
Copy link
Owner

sharkdp commented Jun 4, 2022

This is not something that we control. Please read the documentation here: https://github.com/sharkdp/bat#on-ubuntu-using-apt

@ninsy
Copy link

ninsy commented Jun 16, 2022

For me (using zsh with oh-my-zsh @ WSL2) it worked when I used

ln -s /usr/bin/batcat $HOME/.local/bin/bat

instead of

ln -s /usr/bin/batcat ~/.local/bin/bat

also I have prepended by adding .local to $PATH: export PATH="$PATH:$HOME/.local/bin".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants