Read-only file system when trying to set new build.path on Mac

I wanted to move my build directory on my Mac and found these instructions, which I followed.

Arduino compiler output location on a Mac? - Using Arduino / Programming Questions - Arduino Forum

Which said to edit the preferences.txt to include:

build.path=~/Documents/Arduino/build

But I am getting an error now when I try to compile:

java.nio.file.FileSystemException: /~: Read-only file system
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:384)
	at java.nio.file.Files.createDirectory(Files.java:674)
	at java.nio.file.Files.createAndCheckIsDirectory(Files.java:781)
	at java.nio.file.Files.createDirectories(Files.java:767)
	at processing.app.Sketch.getBuildPath(Sketch.java:183)
	at cc.arduino.Compiler.build(Compiler.java:163)
	at processing.app.SketchController.build(SketchController.java:664)
	at processing.app.Editor$BuildHandler.run(Editor.java:1632)
	at java.lang.Thread.run(Thread.java:748)
/~: Read-only file system

but when I run ls -l I get drwxr-xr-x on the directory.

I also read this article Arduino Preferences | Arduino Documentation | Arduino Documentation

what do you mean by that and what did you do exactly?

Hi @lj001. The problem is your use of the ~ path alias in the property. This is something your shell knows about, which is why it works with a command like ls -l ~/Documents/Arduino/build, but Arduino IDE doesn't know anything about the alias so it is treating this as if it is a literal path.

The solution is to replace the ~ in the property value with the true path:

build.path=/Users/<user name>/Documents/Arduino/build

(replace <user name> in the text above with your macOS user name)

That worked. Thank you.

You are welcome. I'm glad it is working now.

Regards,
Per

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.