macOS Catalina: Julia cannot access general files

I’ve spent some considerable amount of time looking for a solution to this, which I suppose is not very common at all. But I have the most basic Catalina 10.15.4 setup in a brand new machine, and Julia simply doesn’t have permission to read or modify any files. I’ve even granted ‘Full Disk Access’ to both JuliaPro 1.3 and Juila 1.4, and all I get are messages such as ‘IOError: mkdir: permission denied (EACCES)’ (by just starting a Julia 1.4 session) and ‘ERROR: IOError: open: operation not permitted (EPERM)’. I have MATLAB, RStudio and PyCharm in my machine, all work without any problems. I can also install Julia packages without any problem in my JuliaPro setup. Any suggestions? This is making my usage of Julia practically impossible for my projects that require file access.

1 Like

What files is it trying to access?

Thank you for your quick reply. I can’t do any file manipulation (even reading) from my Documents folder (the same files I’ve tried with MATLAB etc.), and a fresh install of Julia 1.4 also reports errors right at the start up when trying to create a default directory:

ERROR: IOError: mkdir: permission denied (EACCES)

Stacktrace:

[1] uv_error at ./libuv.jl:97 [inlined]

[2] mkdir( ::String; mode::UInt16 ) at ./file.jl:177

[3] mkpath( ::String; mode::UInt16 ) at ./file.jl:227

[4] mkpath at ./file.jl:222 [inlined]

[5] setup_interface( ::REPL.LineEditREPL, ::Bool, ::Any ) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:869

[6] setup_interface( ::REPL.LineEditREPL; hascolor::Bool, extra_repl_keymap::Any ) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:779

[7] setup_interface at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:779 [inlined]

[8] (::Pkg.var"#1#2")( ::REPL.LineEditREPL ) at /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.4/Pkg/src/Pkg.jl:519

[9] __atreplinit( ::REPL.LineEditREPL ) at ./client.jl:339

[10] #invokelatest#1 at ./essentials.jl:712 [inlined]

[11] invokelatest at ./essentials.jl:711 [inlined]

[12] _atreplinit at ./client.jl:346 [inlined]

[13] (::Base.var"#764#766"{Bool,Bool,Bool,Bool})( ::Module ) at ./client.jl:382

[14] #invokelatest#1 at ./essentials.jl:712 [inlined]

[15] invokelatest at ./essentials.jl:711 [inlined]

[16] run_main_repl( ::Bool, ::Bool, ::Bool, ::Bool, ::Bool ) at ./client.jl:367

[17] exec_options( ::Base.JLOptions ) at ./client.jl:305

[18] _start() at ./client.jl:484

Also, I’ve reinstalled JuliaPro, and now it can’t install package anymore…

It’s very hard to diagnose what’s happening based only on the error message. Need to see what you’re trying to do as well.

1 Like

For example, file renaming:

julia> mv(“/Users/myusername/Documents/oldname.txt”, “/Users/myusername/Documents/newname.txt”)
ERROR: IOError: open: operation not permitted (EPERM)
Stacktrace:
[1] open(::String, ::UInt16, ::Int64) at /Applications/JuliaPro-1.3.1-1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?
[2] sendfile(::String, ::String) at /Applications/JuliaPro-1.3.1-1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?
[3] #cp#12(::Bool, ::Bool, ::typeof(cp), ::String, ::String) at /Applications/JuliaPro-1.3.1-1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?
[4] rename(::String, ::String) at /Applications/JuliaPro-1.3.1-1.app/Contents/Resources/julia/Contents/Resources/julia/lib/julia/sys.dylib:?
[5] #mv#13 at ./file.jl:386 [inlined]
[6] mv(::String, ::String) at ./file.jl:385
[7] top-level scope at none:0

The equivalent command works in other programming languages (and on Finder, of course).

What does

ls -ld /Users/myusername/Documents/

return in the shell? Also, what does umask in the shell print?

Catalina has been asking me to grant permissions every time an app (including eg iterm2 when I did something from the command line) tries to modify things in any of the “standard” folders (eg Desktop, Downloads, Music etc). I wonder if julia isn’t able to spawn those dialogues for some reason?

2 Likes

I just tried from Julia launched through iterm2, and it didn’t have a problem. Maybe try moving a file from the terminal first, before launching julia?

You apparently have to grant the Julia program access to the Documents folder (etc.) if you launch it by double-clicking: https://www.howtogeek.com/443611/how-macos-catalinas-new-security-features-work/

(If you launch things from the Terminal or similar, then it’s the permissions of the terminal software that matter instead.)

3 Likes

Thanks everybody for the answers so far. I discovered the main issue is related to my Documents folder in particular, for a reason I will explain. I can say that if I create another directory within /Users/myusername, I can manipulate it with my Julia installation. No chance if it’s within /Users/myusername/Documents. I’m really stumped by this, and it seems something very particular to my system configuration. Without wanting to make this too long and testing anyone’s patience, there is a particularity with this machine. When transferring files from an old Mac, a separate user was created to receive then. I then just copied the Documents folder from this other user into the Documents of my main user account. Ownership of Documents and its contents have been properly assigned. No other application is being affected afaik. Applications that are granted access to Documents only and nothing else have no issues, for instance. But somehow this is bothering Julia.

For completeness, I’ll provide some information to the points above. When I do ls -ld /Users/myusername/Documents/, I get

drwxr--r-x@ 31 officialusername  staff  992 27 Mar 22:37 /Users/myusername/Documents/

Sorry for the confusion above: the directory of myusername is actually associated with a slightly different user ID (officialusername, long story, don’t ask). I don’t see this affecting anything, including backup software and anti-viruses. I can’t see how this would affect Julia, as concerning Catalina protections, I’ve already set it up for both JuliaPro and a stand-alone Julia 1.4 to have Full Disk Access. The same is true for Terminal, which has no problems with file manipulation. I recall RStudio prompted for Documents access the first time it was necessary, and MATLAB and PyCharm CE just asked for it at installation time, if I recall it correctly.

umask gives u=rwx,g=rx,o=rx.

(Concerning my comment above regarding my JuliaPro not updating packages anymore, I was actually able to fix it using chown, as actually helpfully suggested in some other page in this forum. So I have a JuliaPro installation that can update packages, but it’s unable to access files in Documents…)