Skip to content

Instantly share code, notes, and snippets.

@tonytonyjan
Last active December 27, 2015 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonytonyjan/7236731 to your computer and use it in GitHub Desktop.
Save tonytonyjan/7236731 to your computer and use it in GitHub Desktop.
一些 Rails 在 Windows 環境的拆地雷方法。

安裝 sqlite3 gem

  1. 官方網站下載兩個東西:

    1. Source Code (for header file)

    2. Precompiled Binaries for Windows (for DLL file)

      給 64 bit 使用者

      由於 SQLite3 官方沒有提供 64 位元的 DLL,我們得自己編譯,好消息是當我們按照 DevKit 安裝手冊完成安裝後就有編譯器可用,以筆者為例,位置在 C:\DevKit\mingw\bin\gcc.exe

      編譯出 sqlite.dll

      > C:\DevKit\mingw\bin\gcc -shared -o sqlite3.dll sqlite3.c
      
  2. 安裝

    > gem install sqlite3 --platform=ruby -- '--with-sqlite3-include="directory contains sqlite3.h" --with-sqlite3-lib="directory contains sqlite3.dll"'
    

安裝 pg gem

  1. 下載 PostgreSQL,安裝後找到以下目錄:

    • C:\Program Files\PostgreSQL\9.3\include
    • C:\Program Files\PostgreSQL\9.3\lib
  2. 安裝

    > gem install pg --platform=ruby -- '--with-pg-include="C:\Program Files\PostgreSQL\9.3\include" --with-pg-lib="C:\Program Files\PostgreSQL\9.3\lib"'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment