# Introjucer line endings on osx?

**URL:** <https://forum.juce.com/t/introjucer-line-endings-on-osx/8686>\
**Category:** The Projucer\
**Created:** [May 13, 2012, 2:01pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686 "2012-05-13T14:01:42Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [May 13, 2012, 2:01pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/1 "2012-05-13T14:01:42Z")

</div>

Hey guys/jules,

why does the introducer generate all files with CRLF on osx?  
it really makes it a pain with git as I have to end up converting all the generated files to mac format each time the introjucer ran its exports!  
should the platform specific line ending be used??

grts,

- bram

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 13, 2012, 7:12pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/2 "2012-05-13T19:12:02Z")

</div>

> [@](#):
>
> I have to end up converting all the generated files to mac format

There’s not really such a thing as “mac format” any more, and every compiler and editor on OSX works just fine with CRLF! I obviously do a lot of dev on all platforms, and I use CRLF in all my files because it works fine everywhere.

---

<div class="post-metadata">

**Author:** ![TheVinn](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/thevinn/32/806_2.png) [@TheVinn](https://forum.juce.com/u/TheVinn)\
**Post date:** [May 13, 2012, 7:28pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/3 "2012-05-13T19:28:30Z")

</div>

> [@jules](#):
>
> I use CRLF

Yeah make sure the “carriage” returns all the way to the left before you roll the paper up and type on the next line…

![](https://us1.discourse-cdn.com/flex026/uploads/juce/original/3X/9/e/9eb220a571bebc635c16a1f2f8eb8fcf03ac21d3.jpeg)

---

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [May 14, 2012, 7:48am UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/4 "2012-05-14T07:48:57Z")

</div>

Hey guys,

may I then ask what git crlf settings you have? The recommended setting is to have LF in the repository and CRLF or LF depending on which platform you check out on.

I.e. on Windows:

git config --global core.autocrlf true  
git config --global core.safecrlf true

And on Mac:

git config --global core.autocrlf input  
git config --global core.safecrlf true

See (among many others):  
[http://help.github.com/line-endings/](http://help.github.com/line-endings/)  
[http://timclem.wordpress.com/2012/03/01/mind-the-end-of-your-line/](http://timclem.wordpress.com/2012/03/01/mind-the-end-of-your-line/)

You probably have core.autocrlf = false, but as far as I read just about everyone recommends NOT doing this.

Or am I missing the obvious?

- Bram

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 14, 2012, 8:44am UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/5 "2012-05-14T08:44:20Z")

</div>

I have it set to “don’t fuck around with the content of my files”.

Seriously, if I check a file into GIT, I expect to get the same bytes back out again. Anyone who turns on an option that will silently change the files that it gives you is just asking for trouble.

---

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [May 14, 2012, 9:21am UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/6 "2012-05-14T09:21:39Z")

</div>

OK, fair enough, but… it would be -I suppose- very easy to in the introjucer generate LF and not CRLF on OSX, right? Or basically use the native endline style on all platforms. For you that wouldn’t make a change at all, but for people who do use the git recommended settings it makes a world of difference.

- bram

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 14, 2012, 10:20am UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/7 "2012-05-14T10:20:01Z")

</div>

> [@](#):
>
> it would be -I suppose- very easy to in the introjucer generate LF and not CRLF on OSX, right?

The whole point of the introjucer is that it creates files that you can use in ALL editors and compilers, on all platforms. The best line-ending for achieving that is CRLF, which in my experience works perfectly everywhere.

Personally, I keep all my code in a shared folder which is used by my Windows, OSX and Linux machines. I may run the introjucer in OSX, and then use the resulting project files from Windows. How could that work if the output of the introjucer was dependent on the OS that it was running in?

---

<div class="post-metadata">

**Author:** ![bdejong](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/bdejong/32/288_2.png) [@bdejong](https://forum.juce.com/u/bdejong)\
**Post date:** [May 14, 2012, 12:17pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/8 "2012-05-14T12:17:36Z")

</div>

OK, but that’s how you work… By having the possibility to change line-endings (native \<-\> windows) you support the way anyone works…  
I guess it’s a feature request and no longer a bug report! 🙂

- bram

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 14, 2012, 12:48pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/9 "2012-05-14T12:48:21Z")

</div>

I understand, but it goes totally against my design strategy for the introjucer - I’ve always gone to a lot of effort to ensure that no matter which platform you run it on, the files it generates are always exactly the same.

Can you explain what exactly would go wrong if you turned off this GIT option and just used CRLF on all platforms? Which tool would fail to understand the files? Because I’ve been building on all these OSes for decades and have never had any line-ending problems. Sounds like this GIT setting is “fixing” problems for you that don’t actually exist.

---

<div class="post-metadata">

**Author:** ![yairadix](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yairadix/32/1114_2.png) [@yairadix](https://forum.juce.com/u/yairadix)\
**Post date:** [January 4, 2016, 3:46pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/10 "2016-01-04T15:46:27Z")

</div>

This is bad, I'll explain why:  
  
When&nbsp;Introjucer/Projucer saves files, it converts them to CRLF ("\r\n",&nbsp;Windows "normal" line endings).  
When Xcode saves files, it converts them to LF ("\n",&nbsp;"normal" line endings).

Giving the Projucer a shot, I change the GUI layout, am happy, and get a diff which is huge. Huge diffs make merges/stashes etc impossible and kill the benefits of git. So I have to run "dos2unix" on the file for a reasonable diff. I don't use the Projucer as my only IDE because Xcode has a lot of nicer stuff (completions, navigation, compiler errors) or maybe I'm just used to it.

What "modern" editors, like Atom, do, is preserve the line endings of the file. Let's call it "liberal".&nbsp;Would had been nice if Xcode and&nbsp;Projucer were liberal. However I can't expect Xcode to change because Apple tend to try to force us to do the "right thing" and use the "right" line endings. But maybe at least Introjucer/Projucer can be liberal.

Cheers, Yair

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [January 4, 2016, 5:06pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/11 "2016-01-04T17:06:41Z")

</div>

GIT should sort this out for you..?

What we do here is to run a script to normalise all the endings (and strip whitespace) in a folder before committing anything to git - that way we keep everything tidy and consistent, which is important in a project like juce.

FWIW I think we already had this in our&nbsp;FR list for the introjucer, but it's not a huge priority for us.

---

<div class="post-metadata">

**Author:** ![yairadix](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yairadix/32/1114_2.png) [@yairadix](https://forum.juce.com/u/yairadix)\
**Post date:** [January 10, 2016, 9:53am UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/12 "2016-01-10T09:53:43Z")

</div>

> What we do here is to run a script to normalise all the endings (and strip whitespace) in a folder before committing anything to git - that way we keep everything tidy and consistent, which is important in a project like juce.

I was just looking at JUCE's latest commits through github's interface. And noticed an interesting thing regarding this one:&nbsp;https://github.com/julianstorer/JUCE/commit/99ae5a7668714c084255c020b5760cf30b962b0d  
  
As far as github's concerned, the file was changed completely - all lines deleted and new lines added, and so it will not show a diff.

But&nbsp;running "git show 99ae5a7 -w" reveals that only a few lines actually changed.

Does one have to manually run these scripts? That can sometimes be forgotten.

> GIT should sort this out for you..?

In what way? In a previous comment in this thread (#5) you strongly object to one way of doing this, and I wonder what's the recommend way for&nbsp;git to sort this out for me.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [January 10, 2016, 9:58am UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/13 "2016-01-10T09:58:11Z")

</div>

I think Timur just messed up&nbsp;that file somehow when he committed it (maybe he had it open in a different text editor by mistake or something). Not a big deal, and I fixed it in the next commit. What problem did it cause&nbsp;you?

---

<div class="post-metadata">

**Author:** ![yairadix](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yairadix/32/1114_2.png) [@yairadix](https://forum.juce.com/u/yairadix)\
**Post date:** [January 10, 2016, 10:22am UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/14 "2016-01-10T10:22:19Z")

</div>

> What problem did it cause&nbsp;you?

It caused the minor inconvinience of having to run "git show -w" seperately.

It's a very small problem,&nbsp;but small problems add up and together they make programming harder and derail trains of thought..

---

<div class="post-metadata">

**Author:** ![yairadix](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yairadix/32/1114_2.png) [@yairadix](https://forum.juce.com/u/yairadix)\
**Post date:** [January 10, 2016, 1:46pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/15 "2016-01-10T13:46:04Z")

</div>

Anyhow the point in mentioning this commit is not to complain about this specific commit, but just to point out that this "script before commiting" method isn't a perfect solution, and that it would be better if this Intro/Projucer feature didn't require such a method. In our case we'll need to consider "script before commit" if we will use Projucer, and meanwhile while trying it we'll have to manually run "dos2unix/unix2dos"..

---

<div class="post-metadata">

**Author:** ![timur](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/timur/32/541_2.png) [@timur](https://forum.juce.com/u/timur)\
**Post date:** [January 11, 2016, 11:14am UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/16 "2016-01-11T11:14:00Z")

</div>

Xcode has an option for that... see here. So no need for a script.&nbsp;If you tick that everything should work just as Jules described.

I think in that&nbsp;messed-up commit in question I just didn't have that set correctly.

![]() ![]() ![](https://docs.google.com/uc?id=0B-YcSuujrbGNWEVzZUVRdzhuRG8)

&nbsp;

---

<div class="post-metadata">

**Author:** ![myhrman](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@myhrman](https://forum.juce.com/u/myhrman)\
**Post date:** [February 3, 2016, 3:34pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/17 "2016-02-03T15:34:58Z")

</div>

On the subject of line endings - we have SVG files added as Resource files&nbsp;in Introjucer. When Introjucer generates BinaryData.cpp from these on OS X versus Windows, it does the line endings differently.

For example, BinaryData.cpp generated from Introjucer on Windows:

```
static const unsigned char temp_binary_data_0[] =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"
"<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->\r\n"
```

Same Resource generated from Introjucer on Mac:

```
static const unsigned char temp_binary_data_0[] =
"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
"<!-- Generator: Adobe Illustrator 19.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->\n"
```

It would be nice if Introjucer always created the BinaryData.cpp with CRLF, or if it was a global option.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [February 3, 2016, 3:56pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/18 "2016-02-03T15:56:15Z")

</div>

The binary data generator doesn't modify the data at all. Like the name suggests, it just treats it as binary, it makes no attempt to parse the text or change line endings.

Most likely GIT is changing your line endings.

---

<div class="post-metadata">

**Author:** ![myhrman](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@myhrman](https://forum.juce.com/u/myhrman)\
**Post date:** [February 4, 2016, 7:57am UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/19 "2016-02-04T07:57:07Z")

</div>

Oh, yes, it must be the GIT that is causing it.&nbsp;Sorry for the noise!

---

<div class="post-metadata">

**Author:** ![Ahbee](https://avatars.discourse-cdn.com/v4/letter/a/919ad9/32.png) [@Ahbee](https://forum.juce.com/u/Ahbee)\
**Post date:** [July 10, 2016, 8:06pm UTC](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686/20 "2016-07-10T20:06:09Z")

</div>

What was the solution to this? Same thing happens to me when I run projucer on windows vs on mac. Binarydata files as well as the auto generated files which look like “JuceLibraryCode/juce\_graphics.cpp” all have line endings changed when I look in git diffs?

[Next page](https://forum.juce.com/t/introjucer-line-endings-on-osx/8686.md?page=2)
