Guys, I'm on a mac and want to access the Safari Preferences File using a bash script. I want to know the default folder set by a user for saving downloaded files. I know that the preferences are in the '/Users/username/Library/Safari' folder on mac.

Which file stores the "Save Downloaded files to:" value?

link|improve this question

71% accept rate
feedback

1 Answer

up vote 1 down vote accepted

The following commands will access the preference API and write the preference you want.

defaults write com.apple.safari DownloadsPath = \"~/Downloads\"
defaults write com.apple.safari NSNavLastRootDirectory = \"~/Downloads\"

DownloadsPath is the default download directory. NSNavLastRootDirectory is the folder last accessed in the Save dialog.

The file is ~/Library/Preferences/com.apple.Safari.plist, by the by. But using the defaults utility is preferable to manually modifying the file.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.