Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8531 > unrolled thread
| Started by | Murta <rodrigomurtax@gmail.com> |
|---|---|
| First post | 2012-02-14 11:42 +0000 |
| Last post | 2012-02-17 11:32 +0000 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
Running MathematicaScript in Mac Terminal Murta <rodrigomurtax@gmail.com> - 2012-02-14 11:42 +0000
Re: Running MathematicaScript in Mac Terminal David Reiss <dbreiss@gmail.com> - 2012-02-15 09:41 +0000
Re: Running MathematicaScript in Mac Terminal Murta <rodrigomurtax@gmail.com> - 2012-02-16 20:03 +0000
Re: Running MathematicaScript in Mac Terminal Murta <rodrigomurtax@gmail.com> - 2012-02-16 08:27 +0000
Re: Running MathematicaScript in Mac Terminal Morgan Sutherland <morgan@msutherl.net> - 2012-02-17 11:32 +0000
| From | Murta <rodrigomurtax@gmail.com> |
|---|---|
| Date | 2012-02-14 11:42 +0000 |
| Subject | Running MathematicaScript in Mac Terminal |
| Message-ID | <jhdhbj$he1$1@smc.vnet.net> |
Hi All
I use Mathematica 8 Home edition and I'm testing running Script via
Shell in my MacOS.
I followed the tutorial, changed the permission using chmod a+x
script.m but it doesn't worked.
the script is this (copy and paste the tutorial)
------------------------------------------------
#!/usr/local/bin/MathematicaScript -script
Print /@ RandomVariate[MixtureDistribution[
{1,2},
{NormalDistribution[1,2/10],
NormalDistribution[3,1/10]}],
10, WorkingPrecision -> 50]
------------------------------------------------
I didn't find the MathematicaScript file that the tutorial says it's
in #!/usr/local/bin/MathematicaScript
maybe it could be de problem.
my directory has:
/usr/local/bin>ls
capinfos dvipdf flac mergecap pgpdisk pkill.pl text2pcap
twfind
dftest edit idl2wrs metaflac pgpwde randpkt tshark
wget
dumpcap editcap latex pdf2ps pgrep.pl rawshark twdiff
wireshark
What I'm doing wrong?
tks in advance!
Murta
[toc] | [next] | [standalone]
| From | David Reiss <dbreiss@gmail.com> |
|---|---|
| Date | 2012-02-15 09:41 +0000 |
| Message-ID | <jhfukr$skd$1@smc.vnet.net> |
| In reply to | #8531 |
It turns out that MathematicaScript is located here (assuming your
Mathematica is located in /Applications):
/Applications/Mathematica.app/Contents/MacOS/
rather than in /usr/local/bin
Try pointing there in your script and let the MathGroup know if it
then works.
--David
On Feb 14, 6:42 am, Murta <rodrigomur...@gmail.com> wrote:
> Hi All
> I use Mathematica 8 Home edition and I'm testing running Script via
> Shell in my MacOS.
> I followed the tutorial, changed the permission using chmod a+x
> script.m but it doesn't worked.
>
> the script is this (copy and paste the tutorial)
>
> ------------------------------------------------
> #!/usr/local/bin/MathematicaScript -script
>
> Print /@ RandomVariate[MixtureDistribution[
> {1,2},
> {NormalDistribution[1,2/10],
> NormalDistribution[3,1/10]}],
> 10, WorkingPrecision -> 50]
> ------------------------------------------------
> I didn't find the MathematicaScript file that the tutorial says it's
> in #!/usr/local/bin/MathematicaScript
> maybe it could be de problem.
>
> my directory has:
>
> /usr/local/bin>ls
> capinfos dvipdf flac mergecap pgpdisk pkill.p=
l text2pcap
> twfind
> dftest edit idl2wrs metaflac pgpwde randp=
kt tshark
> wget
> dumpcap editcap latex pdf2ps pgrep.pl rawshark =
twdiff
> wireshark
>
> What I'm doing wrong?
> tks in advance!
> Murta
[toc] | [prev] | [next] | [standalone]
| From | Murta <rodrigomurtax@gmail.com> |
|---|---|
| Date | 2012-02-16 20:03 +0000 |
| Message-ID | <jhjnet$h9o$1@smc.vnet.net> |
| In reply to | #8553 |
First I would like to tks all for the help!
There are the steeps that make it work, let's make it with a simple
toy script:
1- Finde the script path
In mathematica doc, the script is in #!/usr/local/bin/
MathematicaScript but it's not the place in my mathematica 8, so to
find it i used
find /Applications -name "MathematicaScript" (tks to Patrick
Scheibe)
and I finded /Applications/Mathematica.app/Contents/MacOS/
MathematicaScript
2- Write the script
Now, with the write the script with the write shebang (shebang->
#!/ .... I learned that name with Morgan Sutherland post, tks)
I called it math.m (in script you don't need extensions)
-------------------------------------
#!/Applications/Mathematica.app/Contents/MacOS/MathematicaScript - script
Print[1+1]
-------------------------------------
3- Make the script executable
In command line write chmod a-x math.m
4- Put the script in one os the directories in the PATH variable.
This is one missing part in Mathematica manual the get me crazy!..
Mathematica manual says:
"To make the script executable you need to set executable
permissions. After that, the script can be run simply by typing its
name at a shell prompt."
It's not true, the script must be in one of the special PATH
directory, to list it just type:
echo $PATH
5- If you want to insert a new directory into PATH, open
your .bash_profile, and put one line with:
export PATH=/your/directory/name:$PATH
then you have to reopen the terminal
if your .bash_profile doesn't exit, create it you your user directory /
~
6- Put your file math.m in one of the PATH directories
7- Call your script anywhere
Now just type your script name in the prompt (math.m) and be
happy!!...
Tks for all in this puzzle!
[]'s
Murta
On Feb 15, 7:41 am, David Reiss <dbre...@gmail.com> wrote:
> It turns out that MathematicaScript is located here (assuming your
> Mathematica is located in /Applications):
>
> /Applications/Mathematica.app/Contents/MacOS/
>
> rather than in /usr/local/bin
>
> Try pointing there in your script and let the MathGroup know if it
> then works.
>
> --David
>
> On Feb 14, 6:42 am, Murta <rodrigomur...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi All
> > I use Mathematica 8 Home edition and I'm testing running Script via
> > Shell in my MacOS.
> > I followed the tutorial, changed the permission using chmod a+x
> > script.m but it doesn't worked.
>
> > the script is this (copy and paste the tutorial)
>
> > ------------------------------------------------
> > #!/usr/local/bin/MathematicaScript -script
>
> > Print /@ RandomVariate[MixtureDistribution[
> > {1,2},
> > {NormalDistribution[1,2/10],
> > NormalDistribution[3,1/10]}],
> > 10, WorkingPrecision -> 50]
> > ------------------------------------------------
> > I didn't find the MathematicaScript file that the tutorial says it's
> > in #!/usr/local/bin/MathematicaScript
> > maybe it could be de problem.
>
> > my directory has:
>
> > /usr/local/bin>ls
> > capinfos dvipdf flac mergecap pgpdisk pkill=
.p=
> l text2pcap
> > twfind
> > dftest edit idl2wrs metaflac pgpwde ran=
dp=
> kt tshark
> > wget
> > dumpcap editcap latex pdf2ps pgrep.pl rawshar=
k =
> twdiff
> > wireshark
>
> > What I'm doing wrong?
> > tks in advance!
> > Murta
[toc] | [prev] | [next] | [standalone]
| From | Murta <rodrigomurtax@gmail.com> |
|---|---|
| Date | 2012-02-16 08:27 +0000 |
| Message-ID | <jhiele$b2n$1@smc.vnet.net> |
| In reply to | #8553 |
First I would like to tks all for the help!
There are the steeps that make it work, let's make it with a simple
toy script:
1- Finde the script path
In mathematica doc, the script is in #!/usr/local/bin/
MathematicaScript but it's not the place in my mathematica 8, so to
find it i used
find /Applications -name "MathematicaScript" (tks to Patrick
Scheibe)
and I finded /Applications/Mathematica.app/Contents/MacOS/
MathematicaScript
2- Write the script
Now, with the write the script with the write shebang (shebang->
#!/ .... I learned that name with Morgan Sutherland post, tks)
I called it math.m (in script you don't need extensions)
-------------------------------------
#!/Applications/Mathematica.app/Contents/MacOS/MathematicaScript - script
Print[1+1]
-------------------------------------
3- Make the script executable
In command line write chmod a-x math.m
4- Put the script in one os the directories in the PATH variable.
This is one missing part in Mathematica manual the get me crazy!..
Mathematica manual says:
"To make the script executable you need to set executable
permissions. After that, the script can be run simply by typing its
name at a shell prompt."
It's not true, the script must be in one of the special PATH
directory, to list it just type:
echo $PATH
5- If you want to insert a new directory into PATH, open
your .bash_profile, and put one line with:
export PATH=/your/directory/name:$PATH
then you have to reopen the terminal
if your .bash_profile doesn't exit, create it you your user directory /
~
6- Put your file math.m in one of the PATH directories
7- Call your script anywhere
Now just type your script name in the prompt (math.m) and be
happy!!...
Tks for all in this puzzle!
[]'s
Murta
On Feb 15, 7:41 am, David Reiss <dbre...@gmail.com> wrote:
> It turns out that MathematicaScript is located here (assuming your
> Mathematica is located in /Applications):
>
> /Applications/Mathematica.app/Contents/MacOS/
>
> rather than in /usr/local/bin
>
> Try pointing there in your script and let the MathGroup know if it
> then works.
>
> --David
>
> On Feb 14, 6:42 am, Murta <rodrigomur...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Hi All
> > I use Mathematica 8 Home edition and I'm testing running Script via
> > Shell in my MacOS.
> > I followed the tutorial, changed the permission using chmod a+x
> > script.m but it doesn't worked.
>
> > the script is this (copy and paste the tutorial)
>
> > ------------------------------------------------
> > #!/usr/local/bin/MathematicaScript -script
>
> > Print /@ RandomVariate[MixtureDistribution[
> > {1,2},
> > {NormalDistribution[1,2/10],
> > NormalDistribution[3,1/10]}],
> > 10, WorkingPrecision -> 50]
> > ------------------------------------------------
> > I didn't find the MathematicaScript file that the tutorial says it's
> > in #!/usr/local/bin/MathematicaScript
> > maybe it could be de problem.
>
> > my directory has:
>
> > /usr/local/bin>ls
> > capinfos dvipdf flac mergecap pgpdisk pkill=
.p=
> l text2pcap
> > twfind
> > dftest edit idl2wrs metaflac pgpwde ran=
dp=
> kt tshark
> > wget
> > dumpcap editcap latex pdf2ps pgrep.pl rawshar=
k =
> twdiff
> > wireshark
>
> > What I'm doing wrong?
> > tks in advance!
> > Murta
[toc] | [prev] | [next] | [standalone]
| From | Morgan Sutherland <morgan@msutherl.net> |
|---|---|
| Date | 2012-02-17 11:32 +0000 |
| Message-ID | <jhldsj$p02$1@smc.vnet.net> |
| In reply to | #8531 |
Yup, sounds good, but two small notes:
Should be:
chmod a+x =96 (not a-x)
And you can run the script from a directory outside of your PATH if you do:
./math.m
or if you're in another folder:
../path/to/math.m
But I'm guessing you wanted this to be a script that would be available
from any folder with ease in which case yes, you should put it in your PATH.
You might find the Bash guide useful:
http://tldp.org/LDP/Bash-Beginners-Guide/html/ for solving such problems in
the future.
Best,
Morgan
On Thu, Feb 16, 2012 at 3:26 AM, Murta <rodrigomurtax@gmail.com> wrote:
> First I would like to tks all for the help!
> There are the steeps that make it work, let's make it with a simple
> toy script:
> 1- Finde the script path
> In mathematica doc, the script is in #!/usr/local/bin/
> MathematicaScript but it's not the place in my mathematica 8, so to
> find it i used
> find /Applications -name "MathematicaScript" (tks to Patrick
> Scheibe)
> and I finded /Applications/Mathematica.app/Contents/MacOS/
> MathematicaScript
>
> 2- Write the script
> Now, with the write the script with the write shebang (shebang->
> #!/ .... I learned that name with Morgan Sutherland post, tks)
> I called it math.m (in script you don't need extensions)
> -------------------------------------
> #!/Applications/Mathematica.app/Contents/MacOS/MathematicaScript -
> script
> Print[1+1]
> -------------------------------------
> 3- Make the script executable
> In command line write chmod a-x math.m
>
> 4- Put the script in one os the directories in the PATH variable.
> This is one missing part in Mathematica manual the get me crazy!..
> Mathematica manual says:
> "To make the script executable you need to set executable
> permissions. After that, the script can be run simply by typing its
> name at a shell prompt."
> It's not true, the script must be in one of the special PATH
> directory, to list it just type:
> echo $PATH
>
> 5- If you want to insert a new directory into PATH, open
> your .bash_profile, and put one line with:
> export PATH=/your/directory/name:$PATH
> then you have to reopen the terminal
> if your .bash_profile doesn't exit, create it you your user directory /
> ~
>
> 6- Put your file math.m in one of the PATH directories
>
> 7- Call your script anywhere
> Now just type your script name in the prompt (math.m) and be
> happy!!...
>
> Tks for all in this puzzle!
> []'s
> Murta
>
>
>
>
> On Feb 15, 7:41 am, David Reiss <dbre...@gmail.com> wrote:
> > It turns out that MathematicaScript is located here (assuming your
> > Mathematica is located in /Applications):
> >
> > /Applications/Mathematica.app/Contents/MacOS/
> >
> > rather than in /usr/local/bin
> >
> > Try pointing there in your script and let the MathGroup know if it
> > then works.
> >
> > --David
> >
> > On Feb 14, 6:42 am, Murta <rodrigomur...@gmail.com> wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Hi All
> > > I use Mathematica 8 Home edition and I'm testing running Script via
> > > Shell in my MacOS.
> > > I followed the tutorial, changed the permission using chmod a+x
> > > script.m but it doesn't worked.
> >
> > > the script is this (copy and paste the tutorial)
> >
> > > ------------------------------------------------
> > > #!/usr/local/bin/MathematicaScript -script
> >
> > > Print /@ RandomVariate[MixtureDistribution[
> > > {1,2},
> > > {NormalDistribution[1,2/10],
> > > NormalDistribution[3,1/10]}],
> > > 10, WorkingPrecision -> 50]
> > > ------------------------------------------------
> > > I didn't find the MathematicaScript file that the tutorial says it's
> > > in #!/usr/local/bin/MathematicaScript
> > > maybe it could be de problem.
> >
> > > my directory has:
> >
> > > /usr/local/bin>ls
> > > capinfos dvipdf flac mergecap pgpdisk pkill
> .p=
> > l text2pcap
> > > twfind
> > > dftest edit idl2wrs metaflac pgpwde ran=
> dp=
> > kt tshark
> > > wget
> > > dumpcap editcap latex pdf2ps pgrep.pl rawshar=
> k =
> > twdiff
> > > wireshark
> >
> > > What I'm doing wrong?
> > > tks in advance!
> > > Murta
>
>
>
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web