├── README.md └── clickhouse.rb /README.md: -------------------------------------------------------------------------------- 1 | # Homebrew ClickHouse Tap 2 | 3 | This is an unofficial Homebrew repository for the Yandex's [ClickHouse](https://clickhouse.yandex/) DBMS. 4 | 5 | It is relatively new and isn't tested well. 6 | Please consider appending the `--verbose` and `--debug` parameters to the `brew install` command to make it easier to debug the package installation. 7 | If you are having any problems with the precompiled binaries (bottles), append the `--build-from-source` parameter. 8 | 9 | Issues and pull requests are always welcome! 10 | 11 | ## Usage 12 | 13 | Add this repository: 14 | ``` 15 | brew tap hatarist/clickhouse 16 | ``` 17 | 18 | To install the latest `stable` release, run: 19 | ``` 20 | brew install clickhouse 21 | ``` 22 | 23 | Or, to install the `testing` release, run: 24 | 25 | ``` 26 | brew install clickhouse --devel 27 | ``` 28 | 29 | ## Run the server 30 | 31 | Make sure that you've increased the maxfiles parameter as described in [here](https://github.com/yandex/ClickHouse/blob/master/MacOS.md). 32 | Then, to run the server, run: 33 | ``` 34 | brew services start clickhouse 35 | ``` 36 | -------------------------------------------------------------------------------- /clickhouse.rb: -------------------------------------------------------------------------------- 1 | class Clickhouse < Formula 2 | desc "is an open-source column-oriented database management system." 3 | homepage "https://clickhouse.yandex/" 4 | url "https://github.com/yandex/ClickHouse/archive/v1.1.54292-stable.zip" 5 | version "1.1.54292" 6 | sha256 "2c5bcd8a6fb72fb35ee4f40128b950c5e43abf7e81ec59b759b9281334494f7f" 7 | 8 | devel do 9 | url "https://github.com/yandex/ClickHouse/archive/v1.1.54304-testing.zip" 10 | version "1.1.54304" 11 | sha256 "ea94e6f24154ed0cd6aed2f7beaa0a38d81a682fb59ae15e47a019008e4d41da" 12 | end 13 | 14 | bottle do 15 | root_url 'https://github.com/hatarist/homebrew-clickhouse/releases/download/bottle' 16 | sha256 "4a9539797fbedc28412f7bc0bdd1096e3da9eb9109448abe45319091ef99aa94" => :el_capitan 17 | end 18 | 19 | head "https://github.com/yandex/ClickHouse.git" 20 | 21 | depends_on "cmake" => :build 22 | depends_on "gcc@7" => :build 23 | 24 | depends_on "boost" => :build 25 | depends_on "icu4c" => :build 26 | depends_on "mysql@5.7" => :build 27 | depends_on "openssl" => :build 28 | depends_on "unixodbc" => :build 29 | depends_on "libtool" => :build 30 | depends_on "gettext" => :build 31 | depends_on "zlib" => :build 32 | depends_on "readline" => :recommended 33 | 34 | def install 35 | ENV["ENABLE_MONGODB"] = "0" 36 | ENV["CC"] = "#{Formula["gcc@7"].bin}/gcc-7" 37 | ENV["CXX"] = "#{Formula["gcc@7"].bin}/g++-7" 38 | 39 | inreplace "libs/libmysqlxx/cmake/find_mysqlclient.cmake", "/usr/local/opt/mysql/lib", "/usr/local/opt/mysql@5.7/lib" 40 | inreplace "libs/libmysqlxx/cmake/find_mysqlclient.cmake", "/usr/local/opt/mysql/include", "/usr/local/opt/mysql@5.7/include" 41 | 42 | cmake_args = %w[] 43 | cmake_args << "-DUSE_STATIC_LIBRARIES=0" if MacOS.version >= :sierra 44 | 45 | mkdir "build" 46 | cd "build" do 47 | system "cmake", "..", *cmake_args 48 | system "make" 49 | if MacOS.version >= :sierra 50 | lib.install Dir["#{buildpath}/build/dbms/*.dylib"] 51 | lib.install Dir["#{buildpath}/build/contrib/libzlib-ng/*.dylib"] 52 | end 53 | bin.install "#{buildpath}/build/dbms/src/Server/clickhouse" 54 | bin.install_symlink "clickhouse" => "clickhouse-server" 55 | bin.install_symlink "clickhouse" => "clickhouse-client" 56 | end 57 | 58 | mkdir "#{var}/clickhouse" 59 | 60 | inreplace "#{buildpath}/dbms/src/Server/config.xml" do |s| 61 | s.gsub! "/var/lib/clickhouse/", "#{var}/clickhouse/" 62 | s.gsub! "/var/log/clickhouse-server/", "#{var}/log/clickhouse/" 63 | s.gsub! "", "262144" 64 | end 65 | 66 | # Copy configuration files 67 | mkdir "#{etc}/clickhouse/" 68 | mkdir "#{etc}/clickhouse/config.d/" 69 | mkdir "#{etc}/clickhouse/users.d/" 70 | 71 | (etc/"clickhouse").install "#{buildpath}/dbms/src/Server/config.xml" 72 | (etc/"clickhouse").install "#{buildpath}/dbms/src/Server/users.xml" 73 | end 74 | 75 | def plist; <<-EOS.undent 76 | 77 | 78 | 79 | 80 | Label 81 | #{plist_name} 82 | RunAtLoad 83 | 84 | KeepAlive 85 | 86 | ProgramArguments 87 | 88 | #{opt_bin}/clickhouse-server 89 | --config-file 90 | #{etc}/clickhouse/config.xml 91 | 92 | WorkingDirectory 93 | #{HOMEBREW_PREFIX} 94 | 95 | 96 | EOS 97 | end 98 | 99 | def caveats; <<-EOS.undent 100 | The configuration files are available at: 101 | #{etc}/clickhouse/ 102 | The database itself will store data at: 103 | #{var}/clickhouse/ 104 | 105 | If you're going to run the server, make sure to increase `maxfiles` limit: 106 | https://github.com/yandex/ClickHouse/blob/master/MacOS.md 107 | EOS 108 | end 109 | 110 | test do 111 | system "#{bin}/clickhouse-client", "--version" 112 | end 113 | end 114 | --------------------------------------------------------------------------------