Skip to content

Loading…

Homebrew on OS X #5

Closed
tommorris opened this Issue · 40 comments
@tommorris

There ought to be a Homebrew recipe for OS X.

@coffeemug
RethinkDB member

Thanks -- we're on it. RethinkDB currently doesn't build on OS X natively, so if we can provide a homebrew recipe that loads a virtual box instance, we'll do it soon. Otherwise, it'll take a little bit longer to port to OS X.

@rauchg

@coffeemug I think the best alternative at this point would be to provide a vagrant image (headless ubuntu vm)
If I could do:

$ vagrant box add rethinkdb http://rethinkdb.org/vagrant.box

That'd be awesome!

@RyanAmos

@guille I needed the same, I ended up creating a Vagrantfile for it.

See: https://github.com/RyanAmos/rethinkdb-vagrant

@coffeemug
RethinkDB member

@RyanAmos -- thanks, that's awesome! We'll incorporate this into the build and write up instructions!

@hasenj

@RyanAmos That is awesome! Just tried this on my machine, worked smoothly!

Thanks!

I never heard of Vagrant before! Hot stuff.

@coffeemug
RethinkDB member

We'll have a portability discussion on Monday and will have a concrete portability plan.

@rauchg

Very cool @RyanAmos thanks!

@srh srh was assigned
@srh

We have decided to commence work on a native OS X port.

@coffeemug
RethinkDB member

Moving to next. As a mac user who does demos on my laptop, I'm excited to dump the vm!

@keltia

I can give some help to port on FreeBSD as well, it should be close to OS X.

@coffeemug
RethinkDB member

@keltia -- very cool, thanks! We're already on top of the OS X port, can we ping you about FreeBSD when the os x port is checked in?

@coffeemug
RethinkDB member

An update on the state of affairs - rethink now compiles and runs natively on OS X. There are some quirks @srh is still working on, but we're pretty close to having a build we can release.

@srh -- could you enumerate open issues here so we can cross them out as they get done?

@keltia

Please document the exact steps and command-lines needed to do that...

@srh
srh commented

Currently you can build the rethinkdb executable on OS X, but not drivers, by doing the following:

brew install boost protobuf v8 node

Then,

sudo npm install -g less coffee-script
sum gem install ruby_protobuf

Then, add the npm path to $PATH (add /usr/local/share/npm to $PATH).

Then, from rethinkdb/src:

git checkout sam_osx
make clean
make -j5

I recommend adjusting the -j5 option based on how many cores your CPU has.

That'll get the rethinkdb executable built and it'll run. You'll also see some driver-related stuff fail. You can presumably connect to it from drivers on a Linux box, if the latest commit isn't in an unbroken state. The branch is very unstable.

Python drivers:
One way to get python drivers working is to use brew install python && pip install --upgrade distribute && pip install --upgrade pip && pip install protobuf, and then run /usr/local/bin/python. If you want to get the original OS X python version working, you need to install the protobuf module somehow. (I tried using easy_install but it failed, and I haven't looked more closely at that.) I haven't tried just doing pip install rethinkdb, since I was building from source and generally you need to be able to run the driver source.

Here is a list of the problems that need to be resolved:

  • Figure out the safe removal of a vestigial watch_signal function in event_queue_base_t.
  • Fix release build problems.
  • Detect parent process death in the external processes used for executing Javascript.
  • Have the makefile not hard-code static libraries to homebrew paths.
  • Add a new way to detect that a connection gets interrupted. We want to be able to interrupt queries when somebody kill -9's their process, and right now, in the next branch, we're using RDHUP to detect that. We need to do it without using RDHUP, because that's a Linux-specific feature. (This is has been skipped. Linux still uses RDHUP, but OS X won't get a solution until kqueue is implemented, which won't be right away.)
  • Fix the Linux-specific stuff where we try to read system stats from /proc/.
  • Get javascript driver to build (for dataexplorer)
  • Packaging (with homebrew? in an OS X installer?)

The following is of secondary priority and shouldn't be in the scope of this issue (e.g. we can and should close the issue without getting these done):

  • Get python and ruby drivers to build (I think we should get them to build on OS X but we can ship without it, since people can just use the package manager)
  • Get tcmalloc working in OS X.
  • Have the makefile and building work in a user-friendly manner when building from source, so that you don't have to pass in OSX=1 or other arguments when on OS X.

EDIT: rearranged by @coffeemug to reflect priority.

@coffeemug
RethinkDB member

@srh -- now that you've actually been developing on OS X, what's your feel on packaging? Homebrew or .pkg? What do you think is best?

@davidmc24

I had tried to get it building in Homebrew a week or two ago. Here's my progress from then. I plan on circling back to try again at some point, but it's fine if someone else beats me to it.

https://gist.github.com/4258958

@coffeemug
RethinkDB member

Rethink now builds natively on OS X and we generate a .pkg file. The binaries will be publicly available in the coming days, so we're closing the issue. We decided not to add official homebrew support for the time being because a .pkg seems like a much better user experience.

Thanks everyone for help and thanks @srh for incredible work!

@coffeemug coffeemug closed this
@justinmayer

As I mentioned on Hacker News a moment ago, I disagree that the .pkg format is better than a Homebrew formula. The former may, as suggested, offer a "better user experience" initially, but updating is ten times easier via Homebrew. Moreover, the .pkg installs to /usr/bin/ and /usr/share/ — areas that are traditionally reserved for system tools provided by Apple.

Much applause and commendations on the Mac OS X release. I highly encourage you to rethink (hehe) this packaging choice, however. Want to offer both? Awesome. But if you're going to pick one or the other, I think Homebrew is the vastly superior method.

@coffeemug
RethinkDB member

Thanks @justinmayer, we should be able to publish a formula in the next few days.

@justinmayer

Fantastic. Looking forward to it. Congrats on the new release!

@harshjari

I hope I'm not beating a dead horse here but, I was just wondering if a brew formula has been published (i find homebrew to have a much better ux as well).

@coffeemug
RethinkDB member

@harshjari -- a few people were going to send it in, but I think this slipped through the cracks. @RyanAmos -- I knew you had one, could you throw it on github?

@al3xandru

Maybe @justinmayer could help with this?

@justinmayer

If @RyanAmos already has one, that would certainly be the most expedient.

@al3xandru

@justinmayer afaik @RyanAmos created the vagrant "recipe" which has nothing to do with homebrew. So any help will be much appreciated.

@coffeemug
RethinkDB member

@al3xandru -- @RyanAmos also created a homebrew formula (he emailed about it separately).

@RyanAmos

I dropped the ball on this. I had it done when @coffeemug mentioned it above, but got caught up with holidays.

I haven't submitted a pull request yet, but you can install it now with the following command:

brew install https://raw.github.com/RyanAmos/homebrew/rethinkdb-formula/Library/Formula/rethinkdb.rb
@harshjari

Got it to install with the above command, after separately installing the necessary ruby and nodejs dependencies! I'll create a separate issue if I find any problems with the resulting install. Thanks!

@justinmayer

@atnnn: Thanks for contributing your RethinkDB Homebrew formula. I'm not sure if this is the best place to mention it, but I'm having trouble installing RethinkDB via your Homebrew formula. After seeing an error message indicating that LESS is a required dependency, here are the steps I took:

$ brew install node
$ npm install -g less
$ brew install rethinkdb

Error returned:

Unsatisfied dependency: less
Homebrew does not provide Node dependencies; install with:
npm install less
Error: An unsatisfied requirement failed this build.

How is this dependency check performed? For what it's worth, /usr/local/share/npm/bin is on my $PATH, and the lessc binary contained within appears to function as expected:

$ lessc --version
lessc 1.3.3 (LESS Compiler) [JavaScript]

This is on Mac OS X 10.8.2, Xcode 4.6.0, and the January 2013 CLT. Any suggestions as to how to resolve this problem?

@AtnNn
RethinkDB member

Hi @justinmayer. Brew verifies the dependency on less by doing

node -e 'require ("less")'

Which, in my tests, fails unless NODE_PATH is set correctly or less was installed locally (without -g)

@coffeemug
RethinkDB member

@atnnn errr. Does that mean brew instructions on http://www.rethinkdb.com/docs/install/ won't work? (because of lack of -g)?

@RyanAmos

@atnnn The problem @justinmayer mentions is the exact reason why I had to add the following line to the formula I created:
https://github.com/RyanAmos/homebrew/blob/rethinkdb-formula/Library/Formula/rethinkdb.rb#L8

When I was running the following line locally, manually, it works, but within homebrew, for some reason it was failing.
node -e 'require ("less")'

Not sure what the solution is, but I he wasn't the only one having that issue and that's the sole reason for the line I added mentioned above.

@coffeemug
RethinkDB member

I think it's time to reopen this one... :(

@coffeemug coffeemug reopened this
@AtnNn AtnNn was assigned
@justinmayer

@atnnn: The verification you mentioned:

node -e 'require ("less")'

... does indeed fail on my system. It appears NODE_PATH is undefined. From what I can tell from the Node formula, this appears to be normal and intended.

If, however, I manually set a NODE_PATH environment variable to /usr/local/share/npm/lib/node_modules, then the verification passes and brew install rethinkdb proceeds without the aforementioned error.

As a sidebar, it's worth mentioning that the modules_folder definition in the Homebrew formula for Node points to:

"#{HOMEBREW_PREFIX}/share/npm"  # Resolves to: /usr/local/share/npm

... whereas npm install -g less coffee-script actually puts the modules into /usr/local/share/npm/lib/node_modules

I suspect that the relevant line should instead be:

"#{npm_prefix}/lib/node_modules"

... but I say this with complete ignorance of Node, npm, the intentions of the associated Homebrew recipe, and whether it would have any effect on this problem.

@RyanAmos

@justinmayer I believe the line you pointed out could actually be the root of all of these issues. If that truly is a bug, it could be the reason for Homebrew to actually properly find the npm dependencies. I should mention, like you, am unfamiliar with how node and npm are intended to operate within homebrew recipes.

@coffeemug
RethinkDB member

Ok, @atnnn told me to close this, so closing :)

@coffeemug coffeemug closed this
@justinmayer

@coffeemug said:

Ok, @atnnn told me to close this, so closing :)

Um, okay.

I'm sure @atnnn must have his reasons for wanting this issue closed, but it would have been nice to post those reasons here. I've tested this on a completely fresh Mountain Lion 10.8.2 virtual machine, and it behaves the exact same way, so as it stands now the vast majority of folks trying to install RethinkDB via Homebrew are going to be stymied by this problem. If the plan is to file this in an issue elsewhere, why not reference it here as well?

@coffeemug
RethinkDB member

@justinmayer -- err, sorry about that, it was a long week for me. We were going to look into how to fix these on Monday, but decided these bugs are outside of the scope of this issue. I've opened a new see -- see #282.

@kudos

@keltia, @coffeemug are you guys still looking at FreeBSD support?

@coffeemug
RethinkDB member

The new build system (already in next) should make building on freebsd much easier. We're not supporting FreeBSD officially, but if someone would like to submit a patch to the make/configure scripts, we'd gladly accept them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.