Michael
Michael

Reputation: 1185

VSCode unable to find settings.json on Mac

When I try to change the theme, I get an error:

ENOENT: no such file or directory, open '/Users/admin/Library/Application Support/Code/User/settings.json'

If I try and open settings.json from the link in the VSCode settings area, it won't open at all.

If, from the terminal, I do vim "/Users/admin/Library/Application Support/Code/User/settings.json", it opens what seems like a blank or new file. If I type :wq vim shows me the following error:

"~/Library/Application Support/Code/User/settings.json" E166: Can't open linked file for writing

Upvotes: 5

Views: 4794

Answers (2)

Dale E. Moore
Dale E. Moore

Reputation: 431

mkdir -p ~/Library/Application Support/Code/user
touch ~/Library/Application Support/Code/user/settings.json

Now preferences are retained by my golang fyne program. But there's nothing inside settings.json. Where are the preferences being saved?

Upvotes: 0

Michael
Michael

Reputation: 1185

So, here's what I did. I went to ~/Library/Application Support/Code/user and did ls -la. That showed me this,

drwxr-xr-x    7 admin  staff   224 Apr 14 18:29 .
drwx------   33 admin  staff  1056 Apr 14 18:27 ..
drwxr-xr-x    4 admin  staff   128 Apr 14 18:27 globalStorage
-rw-r--r--    1 admin  staff   103 Dec  3 14:18 keybindings.json
lrwxr-xr-x    1 admin  staff    42 Feb 13 10:16 settings.json -> /Users/admin/dotfiles/vscode/settings.json
drwxr-xr-x    2 admin  staff    64 Jun 11  2018 snippets
drwxr-xr-x  109 admin  staff  3488 Apr 14 18:28 workspaceStorage

So I tried to look at the file settings.json was linked to, but the whole path starting at dotfiles didn't even exist. So instead I deleted settings.json (rm settings.json) and made it again using touch settings.json. After that I haven't had any problems.

Upvotes: 5

Related Questions