/usr/local/bin not writable
grasshoppermouse opened this issue ยท 45 comments
I get this error either using either tinytex::install_tinytex()
or the os x install script
macOS 10.13.3
add_link_dir_dir: destination /usr/local/bin not writable, no links from /Users/hagen/Library/TinyTeX/bin/x86_64-darwin. add of symlinks had 1 error(s), see messages above. add of symlinks had 1 error(s), see messages above. tlmgr: An error has occurred. See above messages. Exiting.
That is odd. /usr/local/bin
should be writable by default on (at least recent versions of) macOS. Anyway, you can run the following code in your terminal (not in the R console). Please run the exact code provided here:
# create the dir if it doesn't exist
[ -e /usr/local/bin ] || sudo mkdir -p /usr/local/bin
# change owner of the dir
sudo chown -R `whoami`:admin /usr/local/bin
Then this in your terminal (do not use sudo
here!):
~/Library/TinyTeX/bin/*/tlmgr path add
That worked. Thanks!
+1 just hit this issue on a completely fresh Mac running High Sierra. The informative error message was a life saver. Thanks for the user focused development!
FYI Of 50+ students using macOS 6 have (sofar) reported this error. I'm providing the hack below to check if /usr/local/bin
is writeable and move on with the install process. Is there an easier/cleaner way to do this perhaps?
if (file.access("/usr/local/bin", mode = 2) == -1) {
tf <- tempfile()
cat("#!/bin/bash\nsudo chown -R `whoami`:admin /usr/local/bin\nRscript -e 'tinytex::install_tinytex()'\n", file = tf)
Sys.chmod(tf, mode = "0755")
system(paste0('osascript -e \'tell application "Terminal" to activate\' -e \'tell application "Terminal" to do script "', tf, '"\''))
} else {
tinytex::install_tinytex()
}
I can make TinyTeX work without requiring /usr/local/bin
to be writable. The only problem is that TinyTeX will only work with tinytex. Writing symlinks to /usr/local/bin
will make sure that LaTeX can be found on PATH
, hence accessible to other programs in the system.
"accessible to other programs in the system" is certainly important. Thanks for the great tool @yihui
Just tried to install using
install.packages('tinytex')
and tinytex::install_tinytex()
in R on MacOS (Mojave) and am having the same issue. But I am VERY very new to this, so could be user error? I have no idea what I'm doing.
@zoelzilz First, please make sure you have installed the latest version of tinytex (>= 0.9). Then when you see a dialog like this, input your password if you trust me:
otherwise follow what the error message tells you to do.
@vnijs Does file.access('/usr/local/bin', 2)
return 0
?
Can she also try the method I mentioned in my first reply above?
Same problem here. file.access('/usr/local/bin', 2)
returns -1
.
@jenzopr Even after you did what I said above in the first reply? #24 (comment)
I was encountering the same errors as vnijs on HighSierra OS. What finally seemed to work was using the suggesting in comment #2 and then running tinytex::install_tinytex(force = TRUE)
This is still an issue. The prompt is not showing up on mac OS to prompt for the users password. Also the documention does not mention the force=TRUE option. Could you add that to: https://yihui.name/tinytex/?
Please try the current development version of tinytex. It no longer requires /usr/local/bin
to be writable. Things should work out of the box if you are compiling R Markdown to PDF or calling tinytex::latexmk()
to compile LaTeX documents.
Thanks @yihui. I used tinytex::uninstall_tinytex()
and then tinytex::install_tinytex()
and it seems the TinyTex is now installed into /Users/username/Library/TinyTex
. That seems like a great idea and everything seems to work fine so far. That said, I'm a bit confused by the latest commit (4e902ba) that still refers to /usr/local/bin
in install.R
and checks if that directory is writable. Can you elaborate perhaps?
@vnijs There was no change in the installation dir (it has always been ~/Library/TinyTeX
). The change was that I'd attempt to create symlinks from ~/Library/TinyTeX
to /usr/local/bin
, and if it fails, I'd give up instead of signaling an error (as I did before). If you compile LaTeX documents through the R package tinytex (which is what the rmarkdown package does), I won't require LaTeX symlinks under /usr/local/bin
.
The downside is as I said previously at #24 (comment): if those symlinks are not under /usr/local/bin
, it means TinyTeX cannot be called directly by other software packages in the system without using the full path. This is not a concern for R Markdown users. Compared to the constant confusion caused by the /usr/local/bin
that is not writable, I feel this is an acceptable downside. What's more, if anyone is really bitten by this issue, I have provided the solution in the very first reply in this thread (i.e., #24 (comment)).
Got it. Thanks @yihui. It seems like everything is working fine. If my students do hit any snags I'll let you know.
FYI Some of my students still seem to be having problems installing tinytex on macOS because /usr/local/bin is not writable (see message below). I'll be able to investigate in more detail when I see the students in a few weeks.
done running updmap-sys.
regenerating fmtutil.cnf in /Users/ross/Library/TinyTeX/texmf-dist
running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine tex ...
done running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine tex.
running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --byfmt mf ...
done running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --byfmt mf.
tlmgr: package log updated: /Users/ross/Library/TinyTeX/texmf-var/web2c/tlmgr.log
add_link_dir_dir: destination /usr/local/bin not writable, no links from /Users/ross/Library/TinyTeX/bin/x86_64-darwin.
add of symlinks had 1 error(s), see messages above.
tlmgr: An error has occurred. See above messages. Exiting.
Error: Failed to install TinyTeX
I just created a new user account on my mac and was able to reproduce the problem (see below for latest version on CRAN 0.15). Tinytex still asks to run a script to change permissions but install fails at the end. Any suggestions?
running mktexlsr ...
done running mktexlsr.
running updmap-sys ...
done running updmap-sys.
regenerating fmtutil.cnf in /Users/rsm-vnijs/Library/TinyTeX/texmf-dist
running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine tex ...
done running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --no-error-if-no-format --byengine tex.
running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --byfmt mf ...
done running fmtutil-sys --no-error-if-no-engine=luajittex,mfluajit --byfmt mf.
tlmgr: package log updated: /Users/rsm-vnijs/Library/TinyTeX/texmf-var/web2c/tlmgr.log
add_link_dir_dir: destination /usr/local/bin not writable, no links from /Users/rsm-vnijs/Library/TinyTeX/bin/x86_64-darwin.
add of symlinks had 1 error(s), see messages above.
tlmgr: An error has occurred. See above messages. Exiting.
A quick update. I'm currently setting up my Mac with an M1 processor and ran into the same issue. Running Yihui's instructions (#24 (comment)) helped, but the second command should be (for an M1 Mac):
~/Library/TinyTeX/bin/universal-darwin/tlmgr path add
@dragosmg Thank you! I just updated my instruction above to use the wildcard (i.e. ~/Library/TinyTeX/bin/*/tlmgr
) so that the system architecture won't matter.
Hello! I am new in R. I need to download files in pdf but I am having this error. Anyone can help me please?
tinytex::install_tinytex(force = TRUE)
tlmgr option repository 'ctan'
tlmgr: setting default package repository to https://mirror.ctan.org/systems/texlive/tlnet
@MariaQuintero I don't see any error. I see a message. If that is what you meant, you can safely ignore the message.
Hi there I was trying to instal tinytex to R on mac (big sur) and I got this message. How do I check if tinytex already installed?
thank you
install.packages('tinytex')
trying URL 'https://cran.rstudio.com/bin/macosx/contrib/4.1/tinytex_0.32.tgz'
Content type 'application/x-gzip' length 120964 bytes (118 KB)
==================================================
downloaded 118 KB
The downloaded binary packages are in
/var/folders/6d/z47gjjtj2nddcb7bz6g8b2_00000gn/T//Rtmp48LdEA/downloaded_packages
tinytex::install_tinytex()
The directory /usr/local/bin is not writable. I recommend that you make it writable. See #24 for more info.
trying URL 'https://yihui.org/tinytex/TinyTeX-1.tgz'
Content type 'application/octet-stream' length 86955319 bytes (82.9 MB)
downloaded 82.9 MB
add_link_dir_dir: destination /usr/local/bin not writable, no links from /Users/marcosteph/Library/TinyTeX/bin/universal-darwin.
tlmgr: An error has occurred. See above messages. Exiting.
TLUtils::add_remove_symlinks: add of symlinks had 1 error(s), see messages above.
@marcsteph Please either see my very first reply in this thread to fix the problem, or ignore the message if you use TinyTeX from R.
Hello,@yihui
When I tried to install the TinyTeX, it shows that:
The directory /usr/local/bin is not writable. I recommend that you make it writable. See #24 for more info.
add_link_dir_dir: destination /usr/local/bin not writable, no links from /Users/xingyue.chen/Library/TinyTeX/bin/universal-darwin.
tlmgr: An error has occurred. See above messages. Exiting.
And then I used the above codes
sudo chown -R whoami
:admin /usr/local/bin
but it shows that
unexpected symbolๅจ"sudo chown"้
what is the problem? thank you
@Xingyue-Chen The problem is that you ran the code in the R console, but should really run it in your terminal. I've added emphasis in my first reply.
Another note that this worked liked a charm! Thanks Yihui!
I get error message after both:
sudo chown -R whoami
:admin /usr/local/bin
chown: /usr/local/bin: No such file or directory
~/Library/TinyTeX/bin/*/tlmgr path add
mkdir(/usr/local/bin/) failed for tree /usr/local/bin: Permission denied
TLUtils::add_remove_symlinks: add of symlinks had 1 error(s), see messages above.
tlmgr: An error has occurred. See above messages. Exiting.
@tortoisenme I don't know how it could be possible that /usr/local/bin
doesn't exist, but you can create it anyway:
sudo mkdir -p /usr/local/bin
I ran the code into my terminal but when it asks for a password it wont let me write anything
@KingxSlayer Just type the password. Nothing will show up as you type, but that's normal.
I am seeing similar issue. When I try
tinytex::install_tinytex()
I get
The directory /usr/local/bin is not writable. I recommend that you make it writable. See https://github.com/yihui/tinytex/issues/24 for more info.
trying URL 'https://yihui.org/tinytex/TinyTeX-1.tgz'
Content type 'application/octet-stream' length 88429277 bytes (84.3 MB)
==================================================
downloaded 84.3 MB
add_link_dir_dir: destination /usr/local/bin not writable, no links from /Users/dlw/Library/TinyTeX/bin/universal-darwin.
tlmgr: An error has occurred. See above messages. Exiting.
TLUtils::add_remove_symlinks: add of symlinks had 1 error(s), see messages above
When I try the solution @yihui I get:
Do you see what I am doing wrong here?
Thank you!
@d-linnard Please use the exact command above: #24 (comment) That is, you should not replace `whoami`
with `dlw`
(whoami
is a command that returns your username).
Tried all instructions given above in order to be able to knit to pdf on rstudio but still giving directory error.
Got message :
trying URL 'https://yihui.org/tinytex/TinyTeX-1.tgz'
Content type 'application/octet-stream' length 88706703 bytes (84.6 MB)
==================================================
downloaded 84.6 MB
tlmgr install tlgpg
tlmgr install: package tlgpg not present in repository.
tlmgr: action install returned an error; continuing.
tlmgr: package repository https://ftpmirror1.infania.net/mirror/CTAN/systems/texlive/tlnet (verified)
tlmgr: An error has occurred. See above messages. Exiting.
tlmgr update --self
tlmgr install tlgpg
tlmgr install: package tlgpg not present in repository.
tlmgr: action install returned an error; continuing.
tlmgr: package repository https://ftpmirror1.infania.net/mirror/CTAN/systems/texlive/tlnet (verified)
tlmgr: An error has occurred. See above messages. Exiting.
tlmgr --repository http://www.preining.info/tlgpg/ install tlgpg
tlmgr: package repository http://www.preining.info/tlgpg/ (not verified: pubkey missing)
[1/2, ??:??/??:??] install: tlgpg.universal-darwin [752k]
[2/2, 00:01/00:01] install: tlgpg [1k]
running mktexlsr ...
done running mktexlsr.
tlmgr: package log updated: /Users/seunomoniyi/Library/TinyTeX/texmf-var/web2c/tlmgr.log
tlmgr: command log updated: /Users/seunomoniyi/Library/TinyTeX/texmf-var/web2c/tlmgr-commands.log
tlmgr option repository 'https://ftpmirror1.infania.net/mirror/CTAN/systems/texlive/tlnet'
tlmgr: setting default package repository to https://ftpmirror1.infania.net/mirror/CTAN/systems/texlive/tlnet
tlmgr: updating /Users/seunomoniyi/Library/TinyTeX/tlpkg/texlive.tlpdb
tlmgr update --list
tlmgr: package repository https://ftpmirror1.infania.net/mirror/CTAN/systems/texlive/tlnet (verified)
tlmgr: no updates available
That is odd.
/usr/local/bin
should be writable by default on (at least recent versions of) macOS. Anyway, you can run the following code in your terminal (not in the R console). Please run the exact code provided here:# create the dir if it doesn't exist [ -e /usr/local/bin ] || sudo mkdir -p /usr/local/bin # change owner of the dir sudo chown -R `whoami`:admin /usr/local/binThen this in your terminal (do not use
sudo
here!):~/Library/TinyTeX/bin/*/tlmgr path add
it ask for a password. what should i do?
Input your password, and hit Enter
.
I do believe the procedures here work fine if there is only one account on a Mac, but they don't work if there is a second account and both users want to use TinyTex. The first user will install TinyTex in their home directory, making the symlinks in /usr/local/bin/
that point at files in ~/Library/TinyTeX/bin/*/
. The second user can't reach those files so TinyTex fails for them. If the second user tries to install TinyTex, they can do everything except make the symlinks. If they do manage to run the procedures above, they will break TinyTex for the other user.
The solution is for the second user to install TinyTex, allow the symlink step to fail, then adjust their path to include the ~/Library/TinyTeX/bin/*/
directory. Or they can symlink the files in ~/Library/TinyTeX/bin/*/
into some other private folder that is already in the path. I did the latter and TinyTex works fine for both users now.