# Gcode won't open in ground control on mac

**URL:** <https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363>\
**Category:** Troubleshooting\
**Tags:** gcode\
**Created:** [April 14, 2018, 9:53pm UTC](https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363 "2018-04-14T21:53:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![anesbitt](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/anesbitt/32/4831_2.png) [@anesbitt](https://forums.maslowcnc.com/u/anesbitt)\
**Post date:** [April 14, 2018, 9:53pm UTC](https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363/1 "2018-04-14T21:53:40Z")

</div>

Had everything working fine but now when I try to open newer text files of Gcode I get this error.

![ground%20control%20error](https://canada1.discourse-cdn.com/flex031/uploads/maslowcnc/original/2X/d/d376bfa520792515d9dd01fd278b22e20c697029.tiff)

I’m 'making the Gcode in 'numbers/excell and copying it into text edit where I double check it and rename it with a .nc Then head over to Ground control and open it. This was all working till a day ago. Is there some detail to the text file type that I’m missing? Any better text editors on Mac that don’t cost $100

I suspect it has something to do with the infuriating text edit on Mac but I just can’t figure out what is different between a file that opens fine and one that gets this error.

Any ideas?

---

<div class="post-metadata">

**Author:** ![blurfl](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/blurfl/32/9_2.png) [@blurfl](https://forums.maslowcnc.com/u/blurfl)\
**Post date:** [April 14, 2018, 9:58pm UTC](https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363/2 "2018-04-14T21:58:12Z")

</div>

Can you compress the file and upload it here?

---

<div class="post-metadata">

**Author:** ![blurfl](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/blurfl/32/9_2.png) [@blurfl](https://forums.maslowcnc.com/u/blurfl)\
**Post date:** [April 14, 2018, 10:06pm UTC](https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363/3 "2018-04-14T22:06:17Z")

</div>

> [@anesbitt](#):
>
> rename it with a .nc

You might check that there isn’t a suffix which isn’t showing. In the Finder, highlight the file and cmd-I to ‘Get Info’ about the file and look to see that the file name ends with .nc (or .txt).

---

<div class="post-metadata">

**Author:** ![Bee](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bee/32/2160_2.png) [@Bee](https://forums.maslowcnc.com/u/Bee)\
**Post date:** [April 14, 2018, 10:13pm UTC](https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363/4 "2018-04-14T22:13:38Z")

</div>

You might also have a problem with Line End format that is invisible to see unless you use a hex editor. Can I ask why your hand coding G-code?

Thank you

---

<div class="post-metadata">

**Author:** ![mrfugu](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/mrfugu/32/22_2.png) [@mrfugu](https://forums.maslowcnc.com/u/mrfugu)\
**Post date:** [April 14, 2018, 10:15pm UTC](https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363/5 "2018-04-14T22:15:18Z")

</div>

TextEdit.app saves files by default as RichText not .txt, this can be changed in the ‘save’ dialogue options.

Check out Atom.app ([https://atom.io](https://atom.io)) or the old favorites on the command line, vi and emacs are both there…

There are many options, but TextEdit.app isn’t the best.

---

<div class="post-metadata">

**Author:** ![anesbitt](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/anesbitt/32/4831_2.png) [@anesbitt](https://forums.maslowcnc.com/u/anesbitt)\
**Post date:** [April 15, 2018, 5:27pm UTC](https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363/6 "2018-04-15T17:27:00Z")

</div>

Hi all - I poked around in finder and nothing strange there. All files are plain text and .nc This was working a few days ago so I’ve taken a working code file and a non working one from today. “sunday test2” is the non working one - links here:

> **[working and non working gcode.zip](https://www.dropbox.com/s/bjazya68e6m4ccw/working%20and%20non%20working%20gcode.zip?dl=0)**
>
> Shared with Dropbox

I’m working on a tiny manufacturing project cutting out rectangles with round corners so I had made some progress using a spread sheet to make all the repetitive code. Also was able to eliminate unnecessary machine movements this way. In the past I just selected a whole column in the spread sheet and copy/pasted that into text edit. Just kept doing that for all the different rectangles. So I might have changed something in the spread sheet with some hidden formatting? But of course I can’t see anything that’s different.

Anyway it does seem to be a line ending or hidden text file thing.

Thanks for the help!

---

<div class="post-metadata">

**Author:** ![Gero](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/gero/32/17487_2.png) [@Gero](https://forums.maslowcnc.com/u/Gero)\
**Post date:** [April 15, 2018, 5:45pm UTC](https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363/7 "2018-04-15T17:45:37Z")

</div>

camotivs gives me plenty of:  
ERROR:/home/whoareyou4/Downloads/test/working and non working gcode/sunday test 2.nc:11:4:Invalid character: ‘\x2212’

---

<div class="post-metadata">

**Author:** ![blurfl](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/blurfl/32/9_2.png) [@blurfl](https://forums.maslowcnc.com/u/blurfl)\
**Post date:** [April 15, 2018, 7:27pm UTC](https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363/8 "2018-04-15T19:27:38Z")

</div>

The file that doesn’t work contains the unicode character for “-” everywhere there is a “Z-” Replacing those with an UTF-8 “-” will make the file load correctly. Here’s a ‘fixed’ version: [sunday-test-2-fix.nc](https://canada1.discourse-cdn.com/flex031/uploads/maslowcnc/original/2X/e/ec5404c04e369b3f3f5409f97a55b96cce4dbc62.nc) (5.5 KB)

---

<div class="post-metadata">

**Author:** ![Gero](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/gero/32/17487_2.png) [@Gero](https://forums.maslowcnc.com/u/Gero)\
**Post date:** [April 15, 2018, 7:50pm UTC](https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363/9 "2018-04-15T19:50:37Z")

</div>

grep --color=‘auto’ -P -n “[^\x00-\x7F]” st2.nc

11:G1 Z−0.125 F40  
13:G1 Z−0.25 F40  
15:G1 Z−0.375 F40  
17:G1 Z−0.5 F40  
111:G1 Z−0.125 F40  
113:G1 Z−0.25 F40  
115:G1 Z−0.375 F40  
117:G1 Z−0.5 F40  
210:G1 Z−0.125 F40  
212:G1 Z−0.25 F40  
214:G1 Z−0.375 F40  
216:G1 Z−0.5 F40

This are the line numbers with the ‘other’ minus

Edit: Add the source link [grep-for-all-non-ascii-characters](https://stackoverflow.com/questions/3001177/how-do-i-grep-for-all-non-ascii-characters?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa)

---

<div class="post-metadata">

**Author:** ![anesbitt](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/anesbitt/32/4831_2.png) [@anesbitt](https://forums.maslowcnc.com/u/anesbitt)\
**Post date:** [April 15, 2018, 8:32pm UTC](https://forums.maslowcnc.com/t/gcode-wont-open-in-ground-control-on-mac/3363/10 "2018-04-15T20:32:55Z")

</div>

Awesome! that was it. I had a concatenated text string when I could have just had a negative number for the z value. Got rid of the “Z-” string and used “Z” and the neg number - works great now.

Also I’ll check out more on the invalid characters, Atom and Camotics

thanks all!
