Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Based on certain previous questions, I figured that if my NotebookBrowseDirectory looked like this

Options[$FrontEnd, NotebookBrowseDirectory]
{NotebookBrowseDirectory -> "/Users/brian/mma"}

then the OSX front end would default to saving new notebooks there. Instead it defaults to saving them in the home directory /Users/brian. Does there exist a variable I can set to make the UI default to saving into a different directory from my homedir?

share|improve this question
    
SetDirectory[dir] sets the current working directory to dir –  acl Dec 2 '12 at 2:58
2  
NotebookBrowseDirectory works on Windows and Linux, but on Mac, we allow the operating system to assert its natural behavior over such things. I'm not now so convinced that this was a good idea, but I haven't finished a proper investigation. So, it's possible this behavior will change in the future. –  John Fultz Dec 2 '12 at 8:22
    
@John Fultz I am glad that Mathematica integrates so nicely with OSX. In my opinion it is a elemental feature of OSX that usage of system wide GUI-logic is encouraged and that most programmes out there play within the 'rules'. Examples where custom interfaces are used (e.g. ditching the top menu bar of OSX - like Matlab does) turn out pretty bad in like 99% of the time and just ruin user experience. –  Sascha Dec 2 '12 at 10:39
    
So would an init.m with a SetDirectory[] command work to do more or less what I want? –  Brian B Dec 2 '12 at 20:23
    
No, what Nasser was suggesting was the opposite of what you're asking. Since the Kernel and FrontEnd are separate processes in the OS, each has its own notion of the "current directory". SetDirectory sets the current directory for the Kernel. NotebookBrowseDirectory would set this for the front end, but as John points out above the OSX FrontEnd currently ignores that. –  Itai Seggev Dec 4 '12 at 4:13

1 Answer 1

On OS X (I'm using 10.9 and Mathematica 9) the file chooser dialogue will remember the last location you used.

So if you Save/Open something to/from /Users/brian/mma, then next time you bring up the file chooser it will show the same directory. This should be convenient.

Per John Fultz's comment above (from Dec 2 '12), it is not possible to set this location on OS X by changing CurrentValue[$FrontEnd, "NotebookBrowseDirectory"]. Quoting the comment:

NotebookBrowseDirectory works on Windows and Linux, but on Mac, we allow the operating system to assert its natural behavior over such things. I'm not now so convinced that this was a good idea, but I haven't finished a proper investigation. So, it's possible this behavior will change in the future.

share|improve this answer
    
"On OS X (I'm using 10.9 and Mathematica 9) the file chooser dialogue will remember the last location you used." — That would be great if it were true, but I am also using OS 10.9 and Mathematica 9 and I don't see that behavior at all. Every time I choose "Save as…" or "Open…", the dialog opens to my user folder (~/), regardless of the last location I used. Why don't I see the behavior you describe in this answer? –  thecommexokid Oct 10 at 17:45
    
Or sometimes ~/Documents/. It's always consistent for a given notebook, but sometimes switches for different notebooks. –  thecommexokid Oct 10 at 17:47
1  
@thecommexokid I don't know. I tried it again and mine remembers, both with M9.0.1 and M10.0.1 on OS X 10.9.5. Try this, and restart M, though I don't know if it will help. –  Szabolcs Oct 10 at 18:10
    
Your suggestion had no effect, alas, but I have better diagnosed the problem. The file-chooser will remember my last save/open location up to the granularity of the correct item in my Finder sidebar, but will not remember any sub-directories beyond that. So if I save to ~/Documents/a/ it reopens to ~/Documents/. If I save to ~/Downloads/a/b/c/ it reopens to ~/Downloads/. –  thecommexokid Oct 10 at 18:31
    
The NotebookBrowseDirectory setting in Options for Global Preferences that you pointed me to in the suggestion you linked does get updated to the correct subdirectory each time, though! It's just not where the dialog actually opens to. –  thecommexokid Oct 10 at 18:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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