> ## Content Index
> Fetch the complete content index at: https://sanghunkang.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# MaxOS Hive 설치
- URL: https://sanghunkang.com/ko/installing-hive-on-macos-ko/
- Published: 2017-12-02T00:00:00.000Z
- Updated: 2026-08-31T10:05:49.000Z
- Author: Sanghun Kang
- Tags: dev, #ko, hive, macOS

## 참조

- [https://cwiki.apache.org/confluence/display/Hive/GettingStarted](https://cwiki.apache.org/confluence/display/Hive/GettingStarted?ref=sanghunkang.com)
- [https://noobergeek.wordpress.com/2013/11/09/simplest-way-to-install-and-configure-hive-for-mac-osx-lion/](https://noobergeek.wordpress.com/2013/11/09/simplest-way-to-install-and-configure-hive-for-mac-osx-lion/?ref=sanghunkang.com)

## 1\. Install hive via brew. This will take some time

```bash
brew install hive

```

## 2\. Add hadoop and hive to your path by editing your bash\_profile

- zshell사용자라면 `.bash_profile`대신 `.zshrc`
- `vi ~/.bash_profile`
- 아래 내용 추가 `bash export HADOOP_HOME=/usr/local/Cellar/hadoop/hadoop.version.no export HIVE_HOME=/usr/local/Cellar/hive/hive.version.no/libexec`
- `source ~/.bash_profile`

## 3\. Download the mysql connector

- 버전은 최신버전으로 다운받으면 좋음. \`\`\` $ curl -L ‘[http://www.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.22.tar.gz/from/http://mysql.he.net/'](http://www.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.22.tar.gz/from/http://mysql.he.net/'?ref=sanghunkang.com) | tar xz

$ sudo cp mysql-connector-java-5.1.15/mysql-connector-java-5.1.22-bin.jar /usr/local/Cellar/hive/hive.version.no/libexec/lib/

```

## 4. Create the mysql metastore
-   아래 내용이 나와있는데 mysql을 사용하지 않을거라면 생략해도 무방한듯.
```bash
$ mysql
mysql> CREATE DATABASE metastore;
mysql> USE metastore;
mysql> CREATE USER 'hiveuser'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,ALTER,CREATE ON metastore.* TO 'hiveuser'@'localhost';

```

## 5\. Copy the hive-default-xml template as hive-site.xml

```bash
$ cd /usr/local/Cellar/hive/{hive.version.no}/libexec/conf
$ cp hive-default.xml.template hive-site.xml

```

## 6\. Add/Edit the following lines in your hive-site.xml

```xml
<property>
  <name>javax.jdo.option.ConnectionURL</name>
  <value>jdbc:mysql://localhost/metastore</value>
</property>
<property>
  <name>javax.jdo.option.ConnectionDriverName</name>
  <value>com.mysql.jdbc.Driver</value>
</property>
<property>
  <name>javax.jdo.option.ConnectionUserName</name>
  <value>hiveuser</value>
</property>
<property>
  <name>javax.jdo.option.ConnectionPassword</name>
  <value>password</value>
</property>
<property>
  <name>datanucleus.fixedDatastore</name>
  <value>false</value>
</property>

```

# 7\. Test if hive works

- 여기까지가 흔히 나와있는 설치 가이드.
- 아래처럼 `hive`입력시 잘 실행된다면 설치 성공. `$ hive; hive >`

## 8\. Error Error Error

- 가이드대로 따라하였으나 실행이 되지 않음.
- 내가 겪은 문제들을 어떻게 해결하였는지 기록하고자 함.

### 8.1\. Mysql관련 문제라면

- [참조](http://stackoverflow.com/questions/35655306/hive-installation-issues-hive-metastore-database-is-not-initialized?ref=sanghunkang.com)
- #4에서 만든 계정이 아닌 root계정으로 아래 명령어를 실행 `bash schematool -initSchema -dbType mysql -userName root -passWord {your-password} --verbose`
- localhost에서 작동하는거라면 port는 따로 적어주지 않아도 된다. 아래처럼 `hive-site.xml`에서 url뒤에 따로 port를 명시해주지 않아도 됨. `xml <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/metastore</value> </property>`
- 그냥 localhost만 적어줘도 된다. `xml <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:mysql://localhost:3306/metastore</value> </property>`

## 8.2\. 경로 문제

- 그래도 안된다면 경로문제일 수 있다.
- `The issue is Hadoop "Path" doesn't support ':' in filenames.`
- `hfs-site.xml`의 경로에 `:`가 들어가선 안된다는 뜻. 이 `:`를 제외해야함.
- [참조](http://stackoverflow.com/questions/27099898/java-net-urisyntaxexception-when-starting-hive/42945230?ref=sanghunkang.com)