How can I download NML on mac?
Moderator: Graphics Moderators
- HoratioNelson
- Engineer
- Posts: 14
- Joined: 09 Apr 2022 00:52
- Location: Florida
How can I download NML on mac?
Hello.
I have recently become enticed by the prospect of coding NewGRFs and I have downloaded NML and python, but I was wondering how to install it on python. I have tried many different ways, but there is no section on downloading it for mac in the Wiki. I think I have installed NML in my terminal, but it does not work there.
Thank you very much.
I have recently become enticed by the prospect of coding NewGRFs and I have downloaded NML and python, but I was wondering how to install it on python. I have tried many different ways, but there is no section on downloading it for mac in the Wiki. I think I have installed NML in my terminal, but it does not work there.
Thank you very much.
- andythenorth
- Tycoon
- Posts: 5656
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: How can I download NML on mac?
https://newgrf-specs.tt-wiki.net/wiki/N ... rted#macOS
There's more than one way to do it, but all of them are via Terminal.
You'll need python 3, which Apple do ship bundled on recent macOS. However 'python' in Terminal is usually aliased to the python2.7 that Apple also ship bundled.
I install my own python 3 using the official python mac installer, and set the path to it in ~/.zshrc
I also use a virtualenv to install nmlc and the other dependencies into, as it avoids any clashes with any other python projects.
It's fiddly, but the individual steps are quite learnable.
There's more than one way to do it, but all of them are via Terminal.
You'll need python 3, which Apple do ship bundled on recent macOS. However 'python' in Terminal is usually aliased to the python2.7 that Apple also ship bundled.
I install my own python 3 using the official python mac installer, and set the path to it in ~/.zshrc
I also use a virtualenv to install nmlc and the other dependencies into, as it avoids any clashes with any other python projects.
It's fiddly, but the individual steps are quite learnable.
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
- HoratioNelson
- Engineer
- Posts: 14
- Joined: 09 Apr 2022 00:52
- Location: Florida
Re: How can I download NML on mac?
I have opened the .zshrc file. Now, what do I do?
- HoratioNelson
- Engineer
- Posts: 14
- Joined: 09 Apr 2022 00:52
- Location: Florida
Re: How can I download NML on mac?
By the way, I enjoy the FIRS Industry Replacement Set.
Especially Steeltown.
Especially Steeltown.
- andythenorth
- Tycoon
- Posts: 5656
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: How can I download NML on mac?
Hmm, I can't remember if you actually need to set the path.
If you installed one of the official python binaries from here https://www.python.org/downloads/macos/ it might have set the path for you.
What happens if you type 'python3' in Terminal?
Also what happens if paste '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3' in Terminal?
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
- HoratioNelson
- Engineer
- Posts: 14
- Joined: 09 Apr 2022 00:52
- Location: Florida
Re: How can I download NML on mac?
If I type in python3, it starts python and gives me the">>>"
If I paste /Library/Frameworks/Python.framework/Versions/3.10/bin/python3, it does the same thing.
If I paste /Library/Frameworks/Python.framework/Versions/3.10/bin/python3, it does the same thing.
- andythenorth
- Tycoon
- Posts: 5656
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: How can I download NML on mac?
I would make a virtualenv next. This is entirely optional, but a virtualenv creates an isolated copy of a python environment into which you can install nmlc and it's dependencies.HoratioNelson wrote: ↑10 Apr 2022 01:23 If I type in python3, it starts python and gives me the">>>"
If I paste /Library/Frameworks/Python.framework/Versions/3.10/bin/python3, it does the same thing.
It's then easy to delete a virtualenv if you don't need it, and it avoids any effects to/from other python projects.
https://docs.python.org/3/library/venv.html
I would try something like this.
First cd to the directory you want to make the virtualenv, (somewhere in Home or Documents or Desktop usually).
Then:
Code: Select all
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m venv py310
Code: Select all
source py310/bin/activate
Code: Select all
pip install nml
Then check that nmlc is installed and in the path with this:
Code: Select all
which nmlc
Code: Select all
nmlc --help
You can skip the virtualenv and just pip install nml, but it's less clean long-term.
Last edited by andythenorth on 10 Apr 2022 16:17, edited 1 time in total.
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
- HoratioNelson
- Engineer
- Posts: 14
- Joined: 09 Apr 2022 00:52
- Location: Florida
Re: How can I download NML on mac?
If I type in "/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m py310" it gives me a syntax error.
- HoratioNelson
- Engineer
- Posts: 14
- Joined: 09 Apr 2022 00:52
- Location: Florida
Re: How can I download NML on mac?
If I type in "nmlc --help" it gives me the different commands for nml, so how would I use it in terminal and export the code as a .nml file?
- andythenorth
- Tycoon
- Posts: 5656
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: How can I download NML on mac?
Oops, I pasted a bad command sorry, should have beenHoratioNelson wrote: ↑10 Apr 2022 14:14 If I type in "/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m py310" it gives me a syntax error.
Code: Select all
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m venv py310
To compile a grf from a .nml file. do something like:HoratioNelson wrote: ↑10 Apr 2022 15:52 If I type in "nmlc --help" it gives me the different commands for nml, so how would I use it in terminal and export the code as a .nml file?
Code: Select all
nmlc --grf=foo.grf foo.nml
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
- HoratioNelson
- Engineer
- Posts: 14
- Joined: 09 Apr 2022 00:52
- Location: Florida
Re: How can I download NML on mac?
I have created the virtualenv. If I type in "python3" and write some code, will I be able to export it as a .nml file so I can compile it into a .grf file?
Also, what is a good tool for drawing sprites?
Also, what is a good tool for drawing sprites?
- andythenorth
- Tycoon
- Posts: 5656
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: How can I download NML on mac?
You write the nml code into a text file, saved with .nml extension. Then nmlc compiles that for you into a .grf.HoratioNelson wrote: ↑10 Apr 2022 16:42 I have created the virtualenv. If I type in "python3" and write some code, will I be able to export it as a .nml file so I can compile it into a .grf file?
You can use TextEdit (in plain text mode) or BBEdit or Coda or one of the many other Mac text editors to edit the .nml file. Or even XCode, although that's massive overkill.
I use Photoshop, but that's expensive. I've also used Pixelmator, but I don't know if it can save paletted 8 bit pngs, which is the most common format for sprites (there are alternatives).Also, what is a good tool for drawing sprites?
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
- HoratioNelson
- Engineer
- Posts: 14
- Joined: 09 Apr 2022 00:52
- Location: Florida
Re: How can I download NML on mac?
Hopefully, this will be my last question. No guarantees, though.
How can I get the option to save the text in text edit as a .nml file?
How can I get the option to save the text in text edit as a .nml file?
- andythenorth
- Tycoon
- Posts: 5656
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: How can I download NML on mac?
I just do this, might depend on macOS version.HoratioNelson wrote: ↑10 Apr 2022 18:44 How can I get the option to save the text in text edit as a .nml file?
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
- HoratioNelson
- Engineer
- Posts: 14
- Joined: 09 Apr 2022 00:52
- Location: Florida
Re: How can I download NML on mac?
If I do that, it saves it as Untitled.nml.txt. If I uncheck the "if no extension is provided, use .txt" box and attempt to compile it, it tells me "nmlc ERROR: Input file "Untitled.nml" does not exist"
- andythenorth
- Tycoon
- Posts: 5656
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: How can I download NML on mac?
Rename it with 'Get info' in macOS Finder.
Or use mv in shell.
Or use mv in shell.
Code: Select all
mv Untitled.nml.txt Untitled.nml
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
- HoratioNelson
- Engineer
- Posts: 14
- Joined: 09 Apr 2022 00:52
- Location: Florida
Re: How can I download NML on mac?
If I rename it to "untitled.nml" through get info and try to compile it, it gives me an nmlc error and tells me that the document does not exist.
- HoratioNelson
- Engineer
- Posts: 14
- Joined: 09 Apr 2022 00:52
- Location: Florida
Re: How can I download NML on mac?
It will do the same thing through terminal.
Who is online
Users browsing this forum: le_harv and 19 guests