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

/usr/local/bin not writable #24

Closed
grasshoppermouse opened this Issue Mar 10, 2018 · 19 comments

Comments

Projects
None yet
8 participants
@grasshoppermouse
Copy link

grasshoppermouse commented Mar 10, 2018

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.

@yihui

This comment has been minimized.

Copy link
Owner

yihui commented Mar 10, 2018

That is odd. /usr/local/bin should be writable by default on (at least recent versions of) macOS. Anyway, see https://stackoverflow.com/a/26647594/559676 for how to regain the write permission. In short, run this in your terminal:

sudo chown -R `whoami`:admin /usr/local/bin

Then this in your terminal (do not use sudo here!):

~/Library/TinyTeX/bin/x86_64-darwin/tlmgr path add
@grasshoppermouse

This comment has been minimized.

Copy link
Author

grasshoppermouse commented Mar 10, 2018

That worked. Thanks!

yihui added a commit that referenced this issue May 2, 2018

@DavisVaughan

This comment has been minimized.

Copy link

DavisVaughan commented Sep 2, 2018

+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!

@vnijs

This comment has been minimized.

Copy link

vnijs commented Sep 18, 2018

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()
      }
@yihui

This comment has been minimized.

Copy link
Owner

yihui commented Sep 19, 2018

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.

@vnijs

This comment has been minimized.

Copy link

vnijs commented Sep 19, 2018

"accessible to other programs in the system" is certainly important. Thanks for the great tool @yihui

@yihui

This comment has been minimized.

Copy link
Owner

yihui commented Oct 12, 2018

@vnijs I started working on a new Macbook this week and had this problem myself, so I just applied the trick osascript in install_tinytex() to ask for password to change the owner of /usr/local/bin: 85b626c. Hopefully this will no longer be a problem for macOS users.

@zoelzilz

This comment has been minimized.

Copy link

zoelzilz commented Oct 25, 2018

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.

@yihui

This comment has been minimized.

Copy link
Owner

yihui commented Oct 25, 2018

@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:

image

otherwise follow what the error message tells you to do.

@vnijs

This comment has been minimized.

Copy link

vnijs commented Jan 9, 2019

Just as an FYI ... I just worked with a student that was asked for her password to make /usr/local/bin writable and the install still wasn't successful in the end. Weird. See screenshot below. That said, I just installed on a new mac of my own and it worked fine. Go figure.

image

@yihui

This comment has been minimized.

Copy link
Owner

yihui commented Jan 9, 2019

@vnijs Does file.access('/usr/local/bin', 2) return 0?

Can she also try the method I mentioned in my first reply above?

@jenzopr

This comment has been minimized.

Copy link

jenzopr commented Jan 11, 2019

Same problem here. file.access('/usr/local/bin', 2) returns -1.

@yihui

This comment has been minimized.

Copy link
Owner

yihui commented Jan 11, 2019

@jenzopr Even after you did what I said above in the first reply? #24 (comment)

@dobrowski

This comment has been minimized.

Copy link

dobrowski commented Jan 11, 2019

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)

@Phlogi

This comment has been minimized.

Copy link

Phlogi commented Feb 21, 2019

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/?

yihui added a commit that referenced this issue Mar 5, 2019

no longer require /usr/local/bin to be writable on macOS since I don'…
…t know why sometimes the the /usr/bin/osascript hack doesn't work (#24)
@yihui

This comment has been minimized.

Copy link
Owner

yihui commented Mar 5, 2019

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.

@vnijs

This comment has been minimized.

Copy link

vnijs commented Mar 6, 2019

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?

@yihui

This comment has been minimized.

Copy link
Owner

yihui commented Mar 6, 2019

@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)).

@vnijs

This comment has been minimized.

Copy link

vnijs commented Mar 7, 2019

Got it. Thanks @yihui. It seems like everything is working fine. If my students do hit any snags I'll let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.