loading...

Build Electron application for MacOS (without MacOS?)

jochemstoel profile image Jochem Stoel ・2 min read

This seems like a good question to ask you guys here on dev.to

I advertise to my clients and pretty much anyone who will listen that with the right configuration(s) Node/Electron applications can easily be built for Windows, Linux and MacOS with zero changes in the actual code. (provided that the application has no operating system specific dependencies and other duh objections)

Building a Node application for all three platforms is pretty easy and I have done that a million times. Building my Electron app for Windows and Linux using the electron-builder is no rocket science either. In theory they should also run on MacOS. However I have never actually built an Electron app for MacOS. Mostly this is because I do not own an Apple computer (think I have never physically touched one), it doesn't seem to be possible on Windows and there is no way in hell my laptop will run it virtually.

The Black Eyed Peas asked if I can practice what I'm preachin' so I had a look online if I can maybe rent a VPS somewhere that runs MacOS, then figure out the rest using a form of remote desktop protocol. I did find some cloud solutions that offer MacOS VPS services but most of them are pricey and not worth the investment at this point. I just need a simple build server for compatibility testing and learning purposes, not because I need currently need it in the real world.

So. Dear Apple developers, how would I go about doing that? Preferably without spending $49/month on a VPS that is idle 99.99% of the time.

Posted on Aug 9 '18 by:

jochemstoel profile

Jochem Stoel

@jochemstoel

Pellentesque nec neque ex. Aliquam at quam vitae lacus convallis pulvinar. Mauris vitae ullamcorper lacus. Cras nisi dui, faucibus non dolor quis, volutpat euismod massa. Donec et pulvinar erat.

Discussion

markdown guide
 

I don't have neither Mac nor Linux computer and this project has been built completely on Windows.

It is open source and runs on Travis CI (which I understand is not an option for you) but the key to success is proper coverage with e2e tests (Spectron in case of Electron).

As long as you have your functionality covered with tests you don't have to look for remote desktop solution as the whole build is automated (including the tests).

I would still go with Travis CI or Circle CI (which has a paid plan for OS X builds, only 39$/month), but if you want to save money and don't mind leaking the binaries you can do the following:

  • Build you application locally with electron-packager
  • Upload the binaries to an open source project which is set up for Spectron and contains all your e2e tests
  • Use this poject with Travis CI to run the tests on compiled binaries

If you'd like to keep your binaries in private (and not just the source code) you can go for any cloud solution (like MacinCloud) but again, the most important thing here is the e2e tests - if you have those you don't have to look for remote desktop solution.

 

What about a Mac hosted solution in the cloud?

Haven't tried any but you can find many of them on Google

 

I haven't tried any either but I already mentioned this in the post and said I need it cheaper.

 

Maybe you can try MacinCloud 1$/hr plan and see if it makes sense: portal.macincloud.com/select/#/plans

This way you can build the app and then rent the machine just for the time you need to test it.

The other solution is to ask a friend with a Mac

Woa. So far this seems to be the solution.

 

just find someone near you who have mac

 

Try TravisCI, with every git push, they'll produce a build a add it to your GitHub releases
(with proper configuration, of course.) I've used it before and it works.

 

Hey thanks, this actually seems pretty great although the projects in question are not open source.