1
0
mirror of https://github.com/wg/wrk synced 2025-01-08 06:52:55 +08:00
0 Installing wrk on macOS (Mac OS X)
Christoph Grabo edited this page 2021-04-04 10:56:21 +02:00

The easy route

  • Install Homebrew. See the instructions at brew.sh
  • Install wrk:
brew install wrk

That's it.

The longer version: compiling wrk from source

  • Go to the Mac App Store and install OSX developer tools, i.e., Xcode.
  • Ensure that you have the Xcode command line tools installed.
xcode-select --install
  • Install Homebrew. See the instructions at brew.sh
  • Install OpenSSL latest lib. This will put lib files and *.h files on your OSX box
brew install openssl
  • If you do not have git then install it
brew install git
  • Ensure that the search order for OpenSSL and brew is ahead of system bin
  • You can do the last step by putting this in your ~/.profile
export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
  • Note that brew installs packages to /usr/local/bin

  • Download the source code

git clone https://github.com/wg/wrk.git
cd wrk
  • Now you need to edit the Makefile and add a few things

Change the first two lines from:

CFLAGS  := -std=c99 -Wall -O2 -D_REENTRANT
LIBS    := -lpthread -lm -lcrypto -lssl

To:

CFLAGS  := -std=c99 -Wall -O2 -D_REENTRANT -I/usr/local/opt/openssl/include
LIBS    := -lpthread -lm -lcrypto -lssl -L/usr/local/opt/openssl/lib
  • Note the last step just adds the libs and headers to the OpenSSL that brew installed.

  • Now run make

make
  • Expected output
$ make
Building LuaJIT...
HOSTCC    host/minilua.o
HOSTLINK  host/minilua
DYNASM    host/buildvm_arch.h
HOSTCC    host/buildvm.o
HOSTCC    host/buildvm_asm.o
HOSTCC    host/buildvm_peobj.o
HOSTCC    host/buildvm_lib.o
HOSTCC    host/buildvm_fold.o
HOSTLINK  host/buildvm
BUILDVM   lj_vm.s
ASM       lj_vm.o
CC        lj_gc.o
BUILDVM   lj_ffdef.h
CC        lj_err.o
CC        lj_char.o
BUILDVM   lj_bcdef.h
CC        lj_bc.o
CC        lj_obj.o
CC        lj_str.o
CC        lj_tab.o
CC        lj_func.o
CC        lj_udata.o
CC        lj_meta.o
CC        lj_debug.o
CC        lj_state.o
CC        lj_dispatch.o
CC        lj_vmevent.o
CC        lj_vmmath.o
CC        lj_strscan.o
CC        lj_api.o
CC        lj_lex.o
CC        lj_parse.o
CC        lj_bcread.o
CC        lj_bcwrite.o
CC        lj_load.o
CC        lj_ir.o
CC        lj_opt_mem.o
BUILDVM   lj_folddef.h
CC        lj_opt_fold.o
CC        lj_opt_narrow.o
CC        lj_opt_dce.o
CC        lj_opt_loop.o
CC        lj_opt_split.o
CC        lj_opt_sink.o
CC        lj_mcode.o
CC        lj_snap.o
CC        lj_record.o
CC        lj_crecord.o
BUILDVM   lj_recdef.h
CC        lj_ffrecord.o
CC        lj_asm.o
CC        lj_trace.o
CC        lj_gdbjit.o
CC        lj_ctype.o
CC        lj_cdata.o
CC        lj_cconv.o
CC        lj_ccall.o
CC        lj_ccallback.o
CC        lj_carith.o
CC        lj_clib.o
CC        lj_cparse.o
CC        lj_lib.o
CC        lj_alloc.o
CC        lib_aux.o
BUILDVM   lj_libdef.h
CC        lib_base.o
CC        lib_math.o
CC        lib_bit.o
CC        lib_string.o
CC        lib_table.o
CC        lib_io.o
CC        lib_os.o
CC        lib_package.o
CC        lib_debug.o
CC        lib_jit.o
CC        lib_ffi.o
CC        lib_init.o
AR        libluajit.a
CC        luajit.o
BUILDVM   jit/vmdef.lua
LINK      luajit
OK        Successfully built LuaJIT
CC src/wrk.c
CC src/net.c
CC src/ssl.c
CC src/aprintf.c
CC src/stats.c
CC src/script.c
CC src/units.c
CC src/ae.c
CC src/zmalloc.c
CC src/http_parser.c
LUAJIT src/wrk.lua
LINK wrk