My operating system is Ubuntu. I add some new .m file to /usr/local/Wolfram/Mathematica/9.0/AddOns/Packages/ and then call for it in Mathematica, but failed with the message Get::noopen: "Cannot open !(\"Qdensity.m\").".

What should I do to make it work?

  • $\begingroup$ you probably have no read access? Maybe it is better to put the file in $UserBaseDirectory $\endgroup$ Aug 15, 2013 at 21:50
  • $\begingroup$ @RolfMertig What system on your computer? I can make it work in Windows but not in Ubuntu. And I do not know what is $UserBaseDirectory. You may take your Mathematica for example. Thanks a lot! $\endgroup$ Aug 17, 2013 at 2:48
  • $\begingroup$ In[1]:= $UserBaseDirectory Out[1]= /home/rolfm/.Mathematica Please read the documentation $\endgroup$ Aug 17, 2013 at 9:33
  • $\begingroup$ Thanks! But in which folder? Applications? $\endgroup$ Aug 17, 2013 at 9:45
  • 1
    $\begingroup$ Yes, or Autoload. $\endgroup$ Aug 17, 2013 at 9:51

1 Answer 1


Usually Mathematica under Linux is installed as root. Therefore normal users do not have wite permission to /usr/local/Wolfram/Mathematica/9.0/AddOns/ . This is why you see that message you mentioned. While in principle you could do something like chown -R eden:eden /usr/local/Wolfram , this is neither encouraged nor advisable. Instead, as mentioned in the documentation of Mathematca, you put user-packages into the Applications or Autoload directory inside either $UserBaseDirectory or $BaseDirectory.

However all you really need to do is to put a package somewhere in a directory which is on $Path. I.e. just like MemberQ[$Path, FileNameJoin[{$UserBaseDirectory, "Applications"}]] gives True, so should MemberQ[$Path,"/opt/mpackdir"], which you can easily achieve by something like If[!MemberQ[$Path, "/opt/mydir"],AppendTo[$Path,"/opt/mydir"].

So all is really easy and clear.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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