# Mathematica .m file can not open in Ubuntu

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?

• you probably have no read access? Maybe it is better to put the file in $UserBaseDirectory Aug 15, 2013 at 21:50 • @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! Aug 17, 2013 at 2:48
• In[1]:= $UserBaseDirectory Out[1]= /home/rolfm/.Mathematica Please read the documentation Aug 17, 2013 at 9:33 • Thanks! But in which folder? Applications? Aug 17, 2013 at 9:45 • Yes, or Autoload. Aug 17, 2013 at 9:51 ## 1 Answer 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.